PHP Jquery Ajax call throws net::ERR_EMPTY_RESPONSE PHP Jquery Ajax call throws net::ERR_EMPTY_RESPONSE google-chrome google-chrome

PHP Jquery Ajax call throws net::ERR_EMPTY_RESPONSE


I believe your request is not classed as a "simple request" under the CORS specification:

http://www.w3.org/TR/cors/#simple-cross-origin-request-0

since you are setting a response header for Content-Type: application/json.

So your server will need to handle the preflight request, which involves setting some additional headers on both the request and response for the CORS request to be successful

Here is a good article on what you need to do - check out the bit under "not so simple":

http://www.html5rocks.com/en/tutorials/cors/


I have same problem on my page sometimes.I think this happens because of number of variables or how big they are.I have a page that sends a json of about 250 variables without any problem, but this error occurs in this page while about 1500 variables are to be sent. This problem is new. Every thing even with 3000 variables were without problem, before.This problem occurs for me both in chrome and firefox in recent versions.It's not server side error because I have configured apache to revive 1 million variables of 30 Mb data.


So this can happen for a number of reasons regardless of language or technology being used. I have encountered this with extremely small payloads of 15-20 data points being sent back and forth using angular resource. PHP, Jquery, Angular all handle the error differently but the results down to one of three things happening.

  1. Latency or Network issues, I have had this happen on extremely slow connections, again this could be anything to a bad router or improper firewall configuration to just on a crappy network, to programs like avast that put a proxy in place to protect you from viruses.

  2. High server load, I have forced a server to be at 100% cpu from stress testing and this will happening on random calls because the server is not handing the requests fast enough. This is hard to fix and really is a scaling issue for the system.

  3. Huge Data Sets, large items being sent that the response fails, usually this can be fixed by adjusting your timeout settings on whatever web server you are using.