Search code examples
phpcodeignitergrocery-crudflexigrid

Js autoload function is not working on flexigrid


Well... I am using flexigrid and grocery crud and i am trying to autoload table with js function. I have followed these steps to do this but it isn't working. Table should auto refresh each 5 seconds when something new is added. What am i doing wrong?

js file contain

var interval = null;

window.onload = function() {
    interval = setInterval(callFunc, 5000);    
};

function callFunc() {
       $("#ajax_refresh_and_loading").trigger("click");
}

js calling on controller

$jsfile = base_url('index.php/assets/bootstrap/js/refresh.js');
        $crud->set_js($jsfile);

Steps i have followed

Mini tutorial


Solution

  • I just changed the route and deleted base_url() because it was useless.

    $jsfile = 'assets/bootstrap/js/refresh.js';
    
            $crud->set_js($jsfile);