admin管理员组文章数量:1335138
$.parseJSON is working great in Firefox, Chrome, and Safari using the code below. However, in Internet Explorer 10, the script fails to yield a valid object.
Here's the jsFiddle: /
And the js code:
string = '{"result":"success"}';
$('#json_string').text(string);
item = $.parseJSON(string);
$('#json_result').text(item.result);
Is there a workaround for Internet Explorer that would correct this error?
$.parseJSON is working great in Firefox, Chrome, and Safari using the code below. However, in Internet Explorer 10, the script fails to yield a valid object.
Here's the jsFiddle: http://jsfiddle/gahathat/sq6Lb/
And the js code:
string = '{"result":"success"}';
$('#json_string').text(string);
item = $.parseJSON(string);
$('#json_result').text(item.result);
Is there a workaround for Internet Explorer that would correct this error?
Share Improve this question asked Jul 20, 2013 at 20:02 amsams 1738 bronze badges 5- Which version of jQuery are you using? – Steven V Commented Jul 20, 2013 at 20:07
- Did you only try it with jsFiddle? The error I get from IE9 is related to iframes. – sabof Commented Jul 20, 2013 at 20:11
- I get the same error on my domain as well. – ams Commented Jul 20, 2013 at 20:14
-
I see the error
'$' is undefined
in the IE10 console when opening the fiddle. – Mooseman Commented Jul 20, 2013 at 20:16 - And I've tried jQuery 1.9.1 and 2.0.2 – ams Commented Jul 20, 2013 at 20:16
1 Answer
Reset to default 12This should work:
$(function() {
var string = '{"result":"success"}';
$('#json_string').text(string);
var item = $.parseJSON(string);
$('#json_result').text(item.result);
});
IE has a global object called 'item' which can't be overwritten.
本文标签: javascriptparseJSON not working in Internet Explorer 10Stack Overflow
版权声明:本文标题:javascript - $.parseJSON not working in Internet Explorer 10 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742343708a2457099.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论