我收到一个javascript(prototype.js)错误:在这行代码中出现意外的令牌ILLEGAL:
newFriend = new friend( response[0].@items[0]._id, response[0].@items[0]._nickName, response[0].@items[0]._profilePicture, response[0].@items[0]._tagLine, response[0].@items[0]._isInvite, response[0].@items[0]._confirm );
响应对象如下所示:
[{"@type":"[Lcom.photoviewer.common.model.ThinUser;","@items":[{"_id":"000.060318.05022007.00263.0067ur","_nickName":"siraj","_country":null,"_currentStorageLimit":5000000000,"_currentStorage":0,"_currentFileCount":0,"_profilePicture":null,"_tagLine":null,"_membershipLevel":0,"_isRejected":false,"_isInvite":false,"_confirm":false,"_verifiedOn":1170716666000}]}]
这只发生在谷歌Chrome浏览器和其他webkit浏览器中.它在Firefox中运行良好.
试试这个:
newFriend = new friend( response[0]["@items"][0]._id, response[0]["@items"][0]._nickName, response[0]["@items"][0]._profilePicture, response[0]["@items"][0]._tagLine, response[0]["@items"][0]._isInvite, response[0]["@items"][0]._confirm );
我很确定@
你会遇到问题.
对于奇怪的字符,使用["@items"]
符号而不是(点)符号总是更安全.@items
.