0

I wanted it inside the tag "p" was referring to the first value: query > results > guitars > guitar > second make. is possible ?

javascript:

$.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Fcristianoveloz.com%2Fpodcast5%2Fscripts%2Fguitars.xml'&format=json&diagnostics=true&callback=?", function(data){

    console.log(data);


         });

jsfiddle

2 Answers2

1

A very verbose way to do it, but see http://jsfiddle.net/22Ecw/62/

$.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Fcristianoveloz.com%2Fpodcast5%2Fscripts%2Fguitars.xml'&format=json&diagnostics=true&callback=?", function(data){
             console.log(data);
               $('.make-text').text(data.query.results.guitars.guitar[1].make);
         });
Christopher Marshall
  • 10,678
  • 10
  • 55
  • 94
0

To do exactly what you ask you should use:

$(".make-text").html(data.query.results.guitars.guitar[1].make);

Of course you can see that data.query.results.guitars.guitar is an array so you can go though all items and print them all if you'd like.

Rafael Martinez
  • 772
  • 3
  • 11