ajax reload has invalid json response
ajax reload has invalid json response
When loading the page the table data is loaded no problems using the ajax options. But when using the reload code supplied below i get a invalid json response.
I'm not sure how because (according to JSONLint) I get valid JSON response when accessed from the page with the same php path specified in the data tables ajax options. I also have other tables on the page that use the same reload function without problems.
How can I resolve this issue so I can use this code within my table reload function for all the tables?
$('#verifiedItems').DataTable().ajax.reload();
alert: DataTables warning: table id=verifiedItems - Invalid JSON response
console: ajax is null - jquery.dataTables.js:2592:4
debug code: ucekah
Thanks in advance
Answers
The response from the server is:
That's not valid JSON, hence the error.
I'm afraid I don't know why your server-side script would be returning that.
Allan
This doesnt make much sense to me, what you have displayed is the start of the php page the table is located on, shortly after the title is the table with an id of verifiedItems, not the ajax response.
Is the table not using the same options to populate data on page load(which was successful) as it is on reload?
DT OPTIONS
AJAX RESPONSE
This is the output I get when manually putting the php url (shown in ajax section above) into the browser, this shows 1 item in table:
Am I missing somthing?
Why is the
ajax.reload()
not being able to access the ajax response supplied from the url from the options?All I'm able to go on is the debugger code you gave above and the fact that you state you are getting the invalid JSON error. If you load your debugger trace and for the
#vertifiedItems
table click the "Server interaction" option (its right at the bottom of the page).As you will be able to see there the response is not valid JSON.
To be able to see anything further, or even just to confirm that, I would need a link to the page so I can check it manually.
Allan
Sorry the site is not public, I was hoping you / someone had seen similar symptoms, I will try and find a solution myself.
BTW I am very impressed with your extensive plugin and documentation. Also surprised with your prompt support :) I will purchase once I experiment more, in my second project!
All I can really say is that the JSON error is occurring because invalid JSON is being returned. I can't really say why that is the case though.
Thanks for your kind words :-). Sorry I can't help further here!
Allan