Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
42
rated 0 times [  43] [ 1]  / answers: 1 / hits: 34309  / 15 Years ago, thu, january 28, 2010, 12:00:00

I am getting a javascript (prototype.js) error: Unexpected token ILLEGAL at this line of code:



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
);


the response object looks like this:



[{
@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
}]
}]


This is only happening in the Google Chrome browser and possibly other webkit browsers. It works fine in Firefox.


More From » json

 Answers
6

Try this instead:



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
);


I'm pretty sure @ is giving you a problem.



For weird characters it's always safer to use the [@items] notation instead of the (dot) notation .@items.


[#97726] Monday, January 25, 2010, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dusty

Total Points: 739
Total Questions: 97
Total Answers: 85

Location: Angola
Member since Wed, Apr 13, 2022
2 Years ago
;