Reputation: 139
I'm using Firefox 20.0.1 and Apache. I have some AJAX calls to retrieve an HTML document from the server. The strange thing is that in one function an AJAX call works fine, but in another function to get a different document it doesn't work. Also, it does work in Chrome.
Any ideas on what this could be? The code is as follows:
loc = "Temp\folder1\folder2\title.html";
var req = new XMLHttpRequest();
req.open("POST", loc, false);
req.send();
alert(req.responseText); // Displays "object not found" error.
Background Information:
I am writing an EPUB reader. The EPUB file is stored on the server and extracted using PHP. I want to get (for example) chapter 1's content, which is stored in an HTML document in the extracted location.
Solution
The problem was the Firefox has issues with backslashes in URLs.
I simply replaced all backslashes with forward slashes before sending the request.
Upvotes: 1
Views: 576
Reputation: 50905
The "object not found" text is an alias for an HTTP 404 error in some web servers. If you run alert(req.status);
after your req.send();
, it can provide insight into what may be the problem. In your case, it is in fact showing a 404 error, and can be traced back to the URL having \
characters in it.
Upvotes: 2