2014-11-02 70 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" />