I'm making a request in my JS and getting back a json response from the server just fine in Chrome and IE, but for some reason the response I get from firefox isn't working. It looks like it isn't being encoded with UTF-8, but I know that it is from the server and all of my files are as well. The response I get in FF looks like
incoming Text ��[�{�"�m�e�t�a�d...
(I cut of the vast majority of it, but there is that question mark in between every character). The console then says JSON.parse: unexpected character at line 1 column 1 of the JSON data"
My .ajax call is as follows:
var locationURL = "https://myData.com/Metadata.json";
$.support.cors = true;
var jsonData = $.ajax({
url: locationURL,
method: "GET",
dataType: "json",
cache: false,
});
The response header I get back (from firebug) is:
Accept-Ranges: bytes
Access-Control-Allow-Orig...: *
Connection: Keep-Alive
Content-Length: 81950
Content-Type: application/json; charset=utf-8
Date: Mon, 10 Aug 2015 14:03:51 GMT
Etag: "c80b2-1401e-51c80111c1d00"
HSID: Q01-21C D=601
Keep-Alive: timeout=5, max=100
Last-Modified: Tue, 04 Aug 2015 18:00:52 GMT
Server: Apache/2.4.10 (Unix) OpenSSL/1.0.1j
Again, in Chrome and IE the response I'm getting is perfectly valid JSON, without all those extra characters. I see in the console that chrome makes the request to the URL as I have it typed in, but in the firefox console it adds ?_=1439215432794
to the end of the URL, might this have something to do with it? How do I get it to not add that? I put a #
at the end of the URL when saving it inside locationURL, but that didn't make a difference. I also tried Jquery's getJSON
instead of .ajax
but that also didn't help. Any help or direction would be appreciated! Thanks.