jQuery Ajax or rather Javascript question

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:

  1. ...
  2.             },{
  3.                 "HitSource":"Book",
  4.                 "HitField":"Title",
  5.                 "Author":"George Orwell",
  6.                 "Title":"1984",
  7.                 "Description":"nine teen eighty four",
  8.                 "ISBN":12345678,
  9.                 "Pages":"123"
  10.             },{
  11.             },{
  12.                 "HitSource":"DVD",
  13.                 "HitField":"Description",
  14.                 "Title":"Big Brother",
  15.                 "Director":"George Orwell",
  16.                 "Description":"1984 - cool movie",
  17.                 "EAN":12345678,
  18.                 "Discs":"1"
  19.             },{

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