ajax.url().load()
Load data from the newly set data source URL.
Description
Trigger a load of an Ajax data source when a URL has been set using the ajax.url()
method.
Note ajax.url()
must be used as a setter to set the URL for the load()
method to be available in the returned object.
Type
function ajax.url().load( callback, resetPaging )
- Parameters:
Name Type Optional 1 callback
Yes - default:null Function which is executed when the data has been reloaded and the table fully redrawn. The function is given a single parameter - the JSON data returned by the server, and expects no return.
2 resetPaging
Yes - default:true Reset (default action or
true
) or hold the current paging position (false
). A full re-sort and re-filter is performed when this method is called, which is why the pagination reset is the default action.- Returns:
DataTables.Api instance
Example
Set the Ajax URL and load the data from the new source immediately:
var table = new DataTable('#myTable', {
ajax: 'data.json'
});
table.ajax.url('newData.json').load();
Related
The following options are directly related and may also be useful in your application development.