jquery - AJAX call doesnt appear to ever take place -
i'm trying utilize ajax in combination jquery datatables dynamic tables, problem is, sajaxsource parameter isn't making post request (i utilize chromes web tools check headers , response code, expect post method response). script loading, there no errors jquery in console either. how can ajax phone call happen?
below jquery table:
$(document).ready(function(){ $('#datatable-courses').datatable({ "bjqueryui": true, "bautowidth": false, // disable auto width calculation "spaginationtype": "full_numbers", "sdom": 't<"clear">lfrtip', "bprocessing": true, "bserverside": true, "sservermethod":"post", "sajaxsource": "admin/courses/ajax_get_courses", "idisplaylength": 10, "alengthmenu": [[10, 25, 50, -1], [10, 25, 50, "all"]], "alengthmenu": [[10, 25, 50, 100, 500, 1000], [10, 25, 50, 100, 500, 1000]], "aasorting": [[0, 'asc']], "aasorting": [], // sorting off "aocolumns": [ { "bvisible": true, "bsearchable": true, "bsortable": true, "swidth": "60px" }, { "bvisible": true, "bsearchable": true, "bsortable": true, "swidth": "250px" }, { "bvisible": true, "bsearchable": true, "bsortable": true, "swidth": "70px" }, { "bvisible": true, "bsearchable": true, "bsortable": true, "swidth": "70px", } ], "fnserverparams": function ( aodata ) { aodata.push( { "name": "my_csrf_name", "value": $.cookie('my_csrf_cookie') } ); } }).fnsetfilteringdelay(700); here's @ controller, though uncertainty issue here:
public function ajax_get_courses() { if ( ! $this->input->is_ajax_request() || ! is_server_request_method('post')) { homecoming false; } $this->load->model('courses_model'); $data = $this->courses_model->ajax_get_courses(); echo $data; flush(); exit(); } additiona info :
using jquery datatables 0.7, codeigniter
config var csrf token set true.
have tried adding whole url in sajaxsource as
http://example.com/admin/courses/ajax_get_courses
jquery ajax codeigniter datatables
No comments:
Post a Comment