开发者

IE8 Json problem

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",
    "a开发者_JS百科rtistimage":"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?


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

},],

to

}],
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜