Ajax timeout maybe?

Ajax timeout maybe?

aarontharkeraarontharker Posts: 33Questions: 8Answers: 0

Recently one of my tables has stopped working in my production environment. As far as I'm aware nothing has changed on the hosting server and all of my other tables on the same site are working fine. When opening the page with the table I get the Invalid JSON message.

https://ibb.co/n0MmQF

If I then dig into the developer console it show that I am not getting any response from the php page. The exact same page is working fine in my local testing environment so I'm not sure where to even start looking. Can anyone give me any suggestions?

https://ibb.co/nsrWsv
https://ibb.co/iYn4Cv
https://ibb.co/hXqfkF

Answers

  • allanallan Posts: 52,496Questions: 1Answers: 8,012 Site admin

    The server's error log is the place to start looking. Is there anything shown there?

    Allan

  • aarontharkeraarontharker Posts: 33Questions: 8Answers: 0
    edited March 2018

    Hi Allan, the problem magically went away by itself last time but it has now reappeared. I have checked the server error logs and they don't show any errors all. As I show in my screenshots the php script is actually returning a 200 OK status. Which is, I am assuming, nothing is being logged.

    The problem has spread a little bit in that it is affecting all tables that should return a fairly large selection.

  • allanallan Posts: 52,496Questions: 1Answers: 8,012 Site admin

    Can you link to the page in question so I can help to debug it please.

    Allan

  • aarontharkeraarontharker Posts: 33Questions: 8Answers: 0

    I've just sent link as a private message

  • allanallan Posts: 52,496Questions: 1Answers: 8,012 Site admin

    Thanks. The Ajax response from the server is empty - which is why you are getting an error message from DataTables.

    Have a look at your http server's error log to see if there is anything reported there.

    Allan

  • aarontharkeraarontharker Posts: 33Questions: 8Answers: 0

    The error log is literally empty so no help there. The php.ini error_log directive isn't set so I'm assuming it is sending its error messages to the webserver as well. I can't seem to find a MySQL error log anywhere either.

  • aarontharkeraarontharker Posts: 33Questions: 8Answers: 0

    As an update, I have created a new page not using datatables but pulling the same information and it is working fine.

  • aarontharkeraarontharker Posts: 33Questions: 8Answers: 0

    OK, so I have written a PHP script to generate the AJAX response that should be coming back to that page I sent you and that is working fine. So it is something in the Datatable PHP libraries that is having issues. Is there anything in the libraries that may cause it to respond with an empty response?

  • allanallan Posts: 52,496Questions: 1Answers: 8,012 Site admin

    To be honest it could be anything. It shouldn't of course, but I can't really begin to guess at what is causing the error. Are you able to enable all PHP errors and warnings?

    Allan

  • Mus4Mus4 Posts: 2Questions: 0Answers: 0

    Dear comunity
    I have faced same issuie with Aaron. Php is not sending response so datatables alert same error with Aaron. Is there any function or method to add to ajax that works for if data is not return in defined time alert something rather than error. I am looking for some thing like that.

    Thanks for kind comments.

  • Mus4Mus4 Posts: 2Questions: 0Answers: 0

    Actually php sends blank response

  • allanallan Posts: 52,496Questions: 1Answers: 8,012 Site admin

    A blank response is not valid JSON is the issue. You'd need to debug the server-side code to see why it isn't sending valid JSON. The server's error log is the first place to start.

    Allan

This discussion has been closed.