JSON未定义解决办法

时间:2014-12-05 21:23:41   收藏:0   阅读:206

ie6、ie7下JSON.parse JSON未定义的解决方法

解决方法一:

var jsons = req.responseText;  
var s;  
if (typeof(JSON) == 'undefined'){  
     s = eval("("+jsons+")");  
}else{  
     s = JSON.parse(jsons);  
} 


解决方法二:

调用的页面里引用json2.js即可解决问题(推荐方法二)。

即:

<script type="text/javascript" src="js/json2.js"></script>


 json2.js的下载地址:http://download.csdn.net/detail/icexuan007/4896080


评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!