IE9中没有执行getJSON回调

时间:2012-08-02 10:50:03

标签: jquery internet-explorer internet-explorer-9 getjson

jQuery getJSON中的回调函数永远不会在Internet Explorer 9中被调用,尽管所请求的文件已成功加载(我已在“网络”选项卡中检查过)。

var user = 1;

$.ajaxSetup ({
    cache: false
});

var fileUrl = "/path/to/file.php";

var fetchQuestions = function(kanji)
{    
    alert('this fires');
    $.getJSON(
        fileUrl,
        {action: "get-q", kanji: kanji, user: user},
        function(json)
        {
            alert('this does not fire');
            questions = json;
            currentItem = json.info.kanji;
            showStart(json.info);
        }
    );
};
  • 返回的数据是有效的json
  • 它适用于所有其他浏览器
  • 所请求的文件确实加载了200 OK和Content-Type application / json
  • 文件中的任何位置都没有console.log()调用
  • 控制台中没有错误(在IE9或任何其他浏览器中)

有什么想法吗?

这是返回的JSON:

{"info": {
                "kanji": "線",
                "meanings": "line",
                "desc": "",
                "words": [{"audio":"/jp/files/audio/words/線_せん","kanji":"線","en":"line","jp":"せん"},{"audio":"/jp/files/audio/words/地平線_ちへいせん","kanji":"地平線","en":"horizon","jp":"ちへいせん"},{"audio":"","kanji":"内線","en":"phone extension, indoor wiring, inner line","jp":"ないせん"},{"audio":"","kanji":"直線","en":"straight line","jp":"ちょくせん"},{"audio":"","kanji":"脱線","en":"derailment, digression","jp":"だっせん"},{"audio":"","kanji":"線路","en":"line, track, roadbed","jp":"せんろ"},{"audio":"","kanji":"水平線","en":"horizon","jp":"すいへいせん"},{"audio":"","kanji":"新幹線","en":"shinkansen","jp":"しん・かん・せん"}]
            },
"spots": [{"kanji":"\u5c71","rand_ind":"32"},{"kanji":"\u68ee","rand_ind":"47"},{"kanji":"\u5225","rand_ind":"76"},{"kanji":"\u98ef","rand_ind":"127"},{"kanji":"\u98f2","rand_ind":"175"},{"kanji":"\u9b5a","rand_ind":"203"},{"kanji":"\u5354","rand_ind":"252"},{"kanji":"\u9752","rand_ind":"265"},{"kanji":"\u9032","rand_ind":"302"},{"kanji":"\u805e","rand_ind":"310"},{"kanji":"\u8a08","rand_ind":"311"},{"kanji":"\u4ea4","rand_ind":"362"},{"kanji":"\u4f1a","rand_ind":"367"},{"kanji":"\u53d7","rand_ind":"404"},{"kanji":"\u5973","rand_ind":"463"},{"kanji":"\u90e8","rand_ind":"469"},{"kanji":"\u4e16","rand_ind":"476"}],
"known": "月,後,前,生,?"}

1 个答案:

答案 0 :(得分:1)

json_encode'返回JSON的“已知”部分解决了这个问题!看起来IE在unicode字符方面存在一些问题。