Problem with accessing in DOM with jQuery

Posted by Tristan on Stack Overflow See other posts from Stack Overflow or by Tristan
Published on 2010-04-18T23:59:30Z Indexed on 2010/04/19 0:13 UTC
Read the original article Hit count: 213

Filed under:
|
|
|
|

Hello,

I changed the tree of my JSON-P output, and i cannot access to my object DOM anymore :

Here's my output :

jsonp1271634374310(
{"Inter-Medias":
    {"name":"Inter-Medias","idGSP":"14","average":"80","services":"8.86"}
});

And here's my jQuery script :

success: function(data, textStatus, XMLHttpRequest){
widget = data.name;
widget += data.average ;
....
  1. I know one level is missing, but if I try to do : data.Inter-Medias.name or data.name.name it's still not working. Any idea please ?
  2. I will have case where i'll have multiple Ojbect, so i want to display all of them, how to do that ?

    for (i=0;i < data.length;i++)

Does it look right ?

  1. Bonus question : i understand function(data, textStatus, XMLHttpRequest) that in case of success this function is triggered, the data is what the script recieved from his request, but i have no idea what textStatus or XMLHttpRequest are here too and why ?!

Thank you.

© Stack Overflow or respective owner

Related posts about JSON

Related posts about jsonp