Ajax を介して取得している JSON から値を取得しようとしています。
これは私が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;
}
});
Ajax 部分を削除して JSON をハードコードすると、正常に動作しますが、Ajax を使用して動作させることはできません。
誰かが私が間違っていることを教えてもらえますか?