I\'m making an AJAX call to retrieve some plain text:
$.ajax({
url: \"programData.txt\",
type: \"GET\",
dataType: \"text\",
cache:
You get different response codes when opening a local file via XMLHttpRequest than you do when using an HTTP request. I suspect that since you are opening a a local file, jQuery is choking on the response code, thinking it's an error because it's not 200 OK.
Reference
Example: Non-HTTP synchronous request
Despite its name, XMLHttpRequest can be used for non-HTTP requests. This example shows how to use it to fetch a file from the local file system.
var req = new XMLHttpRequest();
req.open('GET', 'file:///home/user/file.json', false);
req.send(null);
if(req.status == 0)
dump(req.responseText);
The key thing to note here is that the result status is being compared to 0 for success instead of 200. This is because the file and ftp schemes do not use HTTP result codes