ajax.reload is not a function
ajax.reload is not a function

var MBGDATATABLE = $('#MBG_ALS_USERS').DataTable({ ... });
MBGDATATABLE.ajax.reload();
So i had this code and it has been working perfectly fine... Then, I realized that whenever I update the table while on a certain page except page number 1, the table redirects on the page number 1.
To fix this, I revised the reload as per the documentation:
MBGDATATABLE.ajax.reload(null, false);
All of a sudden, it doesn't update anymore and it displays "Uncaught TypeError: MBGDATATABLE.ajax.reload is not a function". I tried to undo the change and returned to the original code. Same error. I didn't change anything except this line on all of my pages that have ajax.reload. Any idea?
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Thanks Colin. I added the HTML and JS code here: http://live.datatables.net/bunalapo/1/edit?html,js
I used server-side and JSON using the following:
<?php > ``` ?>```
<?php
include("../sessions.php");
include("../functions.php");
$sql_details = array(
'user' => DB_USERNAME,
'pass' => DB_PASSWORD,
'db' => DB_NAME,
'host' => DB_SERVER
);
I added the HTML and JS code in here: http://live.datatables.net/bunalapo/1/edit?html,js
I used server-side and JSON:
<?php > ``` ?>```
<?php
include("../sessions.php");
include("../functions.php");
$sql_details = array(
'user' => DB_USERNAME,
'pass' => DB_PASSWORD,
'db' => DB_NAME,
'host' => DB_SERVER
);
The test case isn't running and doesn't appear to have the
MBGDATATABLE.ajax.reload(null, false);
statement. The purpose of the test case is so we can run the page and debug the running code.If you are unable to provide a link to your page or a running test case then I suggest you use the browser's debugger and place a breakpoint at the
MBGDATATABLE.ajax.reload(null, false);
statement. This is the place to start to see what is happening.Make sure
MBGDATATABLE
is assigned to the datatable API usingvar MBGDATATABLE = $('#MBG_ALS_USERS').DataTable()
notvar MBGDATATABLE = $('#MBG_ALS_USERS').dataTable()
with a lower cased
firdatatable. Make sure you aren't reassigning
MBGDATATABLEto something else before using
MBGDATATABLE.ajax.reload(null, false);`.Kevin