JSON未定义解决办法

https://blog.csdn.net/wanglei9876/article/details/41752863

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

解决方法一:

  1. var jsons = req.responseText;
  2. var s;
  3. if ( typeof( JSON) == 'undefined'){
  4. s = eval( "("+jsons+ ")");
  5. } else{
  6. s = JSON.parse(jsons);
  7. }


解决方法二:

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

即:

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


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


猜你喜欢

转载自blog.csdn.net/zunguitiancheng/article/details/80897227