Datatable Tricks

=> In datatable redirect baseurl when session is expired:
  

- In datable.js file write following code: 
"data": function (d) {
                $.getJSON('contacts/ajaxData',myData, function (json) {
                    if (json.expired == '1') {
                        window.location = BASE_URL;
                    }
                });
                return  $.extend(d, myData);
            },
   In, $.getJSON you have to pass controller name/method name (ex. contacts/ajaxData)

- In controller write following code:
if ($this->input->is_ajax_request()){
                echo json_encode(array("expired" => "1"));exit;
            }

Comments

Popular posts from this blog

Application ld json data in shopify

on_sent_ok not working in Contact Form 7 version 5.0.2

Make carousel slider in shopify