Search This Blog

Thursday, 29 November 2012

jQuery Ajax Call Failing

This is a problem I've been having at work for the last week or so.

I am using Apache 2.2 on Windows 7. In my JavaScript I need to read the contents of a text file, so I make this call:

   var fileContent = '';

   jQuery.ajax({
      url: 'myfile.txt',
      dataType: 'text',
      success: function (data) {
         fileContent = data;
      },
   });

which worked fine for months. Then suddenly it began failing, though notably only with large files (> 200K).

The symptoms were one of these:

  1. the Ajax call would fail
  2. the Ajax call would hang
  3. the text that came back was either missing bits or subtly mixed up

In the first case, the browser console would show the message NETWORK_ERR: XMLHttpRequest Exception 101. In case 3 the Apache logs showed a message about No space left on device and Error reading chunk.

The solution was to uninstall a Windows 7 update, namely KB2750841.

I actually experienced this problem back in September, when the update to uninstall was KB2735855. Incredibly I managed to completely forget about that fix, and so had to painfully get to the solution again from scratch. It is my fervent hope that the next time I search for NETWORK_ERR: XMLHttpRequest Exception 101, Google will decide that one of my own blog articles should come top of the search results.