普通网友 2015-08-10 15:11
浏览 10

Firefox中的JSON响应

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料