I have the following JavaScript code in the page. When the ajax call is made, I could see that the browser inspect/debugger section throws net::ERR_EMPTY_RESPONSE
I was having this same error and was able to fix it by sending all the data I need to process in an array to the server, and then having it spit the updated array back to the client, so that only one AJAX call is made.
I wasn't able to determine the exact cause of this issue, but I'm pretty sure what's going on is that some sort of buffer is getting filled to capacity with all those AJAX calls, causing the server to shut down some of those requests.
Hope this helps.