Last.fm seems to put #
symbols in front of some of their variable names for it's JSON API. Have a look at a sample response here. As soon as I try and access #text
with JavaScript I get an invalid symbol error in the console. Any quick fixes or reasons for this hash?
Asked
Active
Viewed 2,066 times
5

Community
- 1
- 1

greenimpala
- 3,777
- 3
- 31
- 39
1 Answers
6
jQuery is only used to retrieve the data. Accessing the #text
data is done through straight JavaScript syntax, something like data.recenttracks.track.artist["#text"]
You can't do artist.#text
, because #
is an invalid first character symbol to be used for accessing an object member. Use the square brackets instead.

Luca Matteis
- 29,161
- 19
- 114
- 169
-
Brilliant, this has fixed it - I'm assuming .artist["varName"] is the same as .artist.varName ? – greenimpala Dec 21 '10 at 13:26