Dynamic population of sAjaxSource and jquery.dataTables.js:1336Uncaught TypeError

Dynamic population of sAjaxSource and jquery.dataTables.js:1336Uncaught TypeError

_jthomas_jthomas Posts: 75Questions: 0Answers: 0
edited June 2011 in DataTables 1.8
Hi Allan,
When I dynamically populate "sAjaxSource": by calling the function oTable.fnReloadAjax("history/" + customerID + ".txt"); I am receiving the error described below in the code. The data gets loaded and is searchable despite this error. However, functions like the following are never invoked after this error. Please advise

$('#searches', this).change( function () {
if( "none" != $(this).val() )
location.href = $(this).val();
}) ;


[code]
/*
* Variable: fnServerData
* Purpose: Function to get the server-side data - can be overruled by the developer
* Scope: jQuery.dataTable.classSettings
*/
this.fnServerData = function ( url, data, callback, settings ) {
settings.jqXHR = $.ajax( {
jquery.dataTables.js:1336Uncaught TypeError: Cannot set property 'jqXHR' of undefined
"url": url,
"data": data,
"success": callback,
"dataType": "json",
"cache": false,
"error": function (xhr, error, thrown) {
if ( error == "parsererror" ) {
alert( "DataTables warning: JSON data from server could not be parsed. "+
"This is caused by a JSON formatting error." );
}
}
} );
};
[/code]

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Are you using the very latest (i.e. from yesterday) fnReloadAjax? fnServerData needs to be passed four parameters for DataTables 1.8 - have a look and see if your copy of the plugin has that.

    Allan
  • _jthomas_jthomas Posts: 75Questions: 0Answers: 0
    Yeah, the one I had accepts only 3 parameters. I will get the latest plugin. Thanks
  • _jthomas_jthomas Posts: 75Questions: 0Answers: 0
    Hi Allan,
    I may be looking at the wrong location - could you point me to the right location for the 1.8 fnReloadAjax plugin? thanks very much!!!
  • _jthomas_jthomas Posts: 75Questions: 0Answers: 0
    Got it - That did the trick. Thanks a bunch!!!
This discussion has been closed.