I'm attempting to extract a value from the JSON data retrieved via Ajax.
Take a look at the example I'm working on here: http://jsfiddle.net/NNrcp/6/.
jQuery.ajax({
url:"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20text%3D%22sta%20India%22&format=json",
success:function(result){
jQuery("#div1").html("<pre>"+result+"</pre>");
console.log(test.query.results.place[0].woeid);
document.getElementById("jname").innerHTML=test.query.results.place[0].woeid;
}
});
If I eliminate the Ajax component and manually input the JSON, everything functions correctly. However, I can't seem to get it to work using Ajax.
Could someone please point out where I may be going wrong?