Post returns 404 after 40.09 seconds (consistent +/- .01) After executing code?

Post returns 404 after 40.09 seconds (consistent +/- .01) After executing code?

Hi,
I've got a csv that I'm uploading via web form. Long story short, to appease my boss, I had to submit the form to a page that forwards the actual processing of the csv by ajax request to another script in the same directory. 

After exactly 40.09 (again, +/- 0.01 seconds) my browser receives a 404 error. During that 40.09 seconds, however, the csv file is being read and my database is being updated by the script that the server can't find?

I feel like there's an implicit timeout somewhere since the amount of time is so precise, but when I run that same exact code on the page, it makes it until codeigniter's set timeout which is much higher than 40.09 seconds...

My question is: Does jquery have an implicit timeout set somewhere for $.post(), or does anyone know what setting would affect this on my server?

Chrome network tab shows:
  1. ProcessQBBalreport.php 404 xhr jquery-1.12.4.min.js:4 1.6 KB 40.08 s
The script php code even explicitly states the response header (for testing purposes)
and echos 2 lines of html code which I simply want to echo out in a span on the page.
  1. header("HTTP/1.1 200 OK");

Code currently looks like this and runs on doc ready.
  1. $.post({
  2. url: 'ProcessQBBalReport.php',
  3. data: {dir:'<?=$target_dir?>'},
  4. success: function(valcount){$('#resultcount').html(valcount);},
  5. error: function(valcount){ console.log("Hit Error!"); $('#resultcount').html(valcount);}
  6. });