IE8 Json问题
我面临着非常奇怪的问题,我从 django 支持的站点获取 JSON 对象并使用 eval() 执行它。它适用于除所有版本的 IE 之外的所有其他浏览器。在 IE 中,我得到“variable_name”为 null 或不是对象。我已经尽了一切努力,但到目前为止还没有运气。
这是我的 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 中不起作用。有什么想法吗?
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.
here is my json object
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"
};
Note:
alert(results.result[0].song)
work just fine, but
$('#somediv').html('<span>'+results.result[0].song+'</span>');
does not work in IE. any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的结果数组末尾有一个额外的逗号。把它去掉就应该没问题了。
到
Your result array has an extra comma at the end. remove it and it should be fine.
to