IE8 Json问题 [英] IE8 Json problem

查看:127
本文介绍了IE8 Json问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临一个非常奇怪的问题,我正在django网站上获取JSON对象,并使用eval()将其执行.除所有版本的IE之外,它都可在所有其他浏览器上使用.在IE中,我收到的"variable_name"为空或不是对象.我已经尽力了,但到目前为止还算不上运气.

I'm facing very strange issue, I'm getting JSON object from django powered site and excuting it using eval(). It works on all the other browsers except all versions of IE. in IE, I am getting "variable_name" is null or not an object. I've tried everything I could but so far no luck.

这是我的json对象

var results = {"result":[
{
    "artist":"somevalue",
    "song":"someothervalue",
    "file":"filepathvalue",
    "views":"0",
    "songid":"1007",
    "artistimage":"default.jpg"
},

{
    "artist":"artistname",
    "song":"songname",
    "file":"anotherfilepath value",
    "views":"0",
    "songid":"1008",
    "artistimage":"default.jpg"
},
],
"prev_page": "0",
"next_page": "2"
}; 

注意:

alert(results.result[0].song)

工作正常,但

$('#somediv').html('<span>'+results.result[0].song+'</span>');

在IE中不起作用.有什么主意吗?

does not work in IE. any idea?

推荐答案

您的结果数组末尾有一个逗号.删除它,应该没问题.

Your result array has an extra comma at the end. remove it and it should be fine.

},],

}],

这篇关于IE8 Json问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆