jQuery Ajax or rather Javascript question
Hi all,
I'm doing a search e.g. for "1984" through an ajax call. The server deliveres JSON like this:
- ...
- },{
- "HitSource":"Book",
- "HitField":"Title",
- "Author":"George Orwell",
- "Title":"1984",
- "Description":"nine teen eighty four",
- "ISBN":12345678,
- "Pages":"123"
- },{
- },{
- "HitSource":"DVD",
- "HitField":"Description",
- "Title":"Big Brother",
- "Director":"George Orwell",
- "Description":"1984 - cool movie",
- "EAN":12345678,
- "Discs":"1"
- },{
Now I can easily access the results trough data.Author etc.
And here's my question:
data.HitField tells me in which field the search term was found, in the second case "Description". So from all the fields I only want to access data.Description. However, I obviously cannot say data.data.Hitfield or var hit = data.Hitfield; var result = data.hit. Any hints?
TIA,
Arnold42