2014-11-02 111 views
0

我在Internet Explorer 'JSON' is undefined上发生了此错误。错误JSON未定义

发生错误的位置:

ajaxCall({ 
    url: me.getAllService, 
    data: JSON.stringify(unionParameters({ filter: filter }, getData(), me.getAllParameters)), 
    success: function (result) { 
     if (typeof (onSuccess) == 'function') 
      onSuccess(result); 
    }, 
    error: function (error) { 
     if (typeof (onFailed) == 'function') 
      onFailed(error); 
    } 
}); 
+0

你知道如果Internet Explorer的版本,你”重新使用支持对象'JSON'? – Matthew 2014-11-02 04:51:43

+0

['JSON'可能重复是IE中的未定义错误](http://stackoverflow.com/questions/5093582/json-is-undefined-error-in-ie-only) – undefined 2014-11-02 04:58:43

+0

@Matthew我使用IE9 – egydeveloper4 2014-11-02 05:18:11

回答

0

JSON解析功能出现在IE8。如果您使用的是IE7或更早版本,则JSON将不确定。

此外,如果您使用IE8,它必须处于标准模式。在怪癖模式下,JSON格式化器将不可用。

在任何情况下,都可以使用polyfills,因此您可以在这些情况下使用JSON格式化程序。向下滚动至“JavaScript”http://www.json.org/有四种可能性。

来源/附加信息:

0

我在母版页中添加以下代码行解决了这个问题:

<meta http-equiv="X-UA-Compatible" content="IE=9" />