普通网友 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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何让企业微信机器人实现消息汇总整合
    • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
    • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
    • ¥15 TLE9879QXA40 电机驱动
    • ¥20 对于工程问题的非线性数学模型进行线性化
    • ¥15 Mirare PLUS 进行密钥认证?(详解)
    • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
    • ¥20 想用ollama做一个自己的AI数据库
    • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
    • ¥15 请问怎么才能复现这样的图呀