因为我可以使用Jquery解析此查询YQL。 我看不到这些信息 非常感谢你
的Json
{
"query": {
"count": 2,
"created": "2012-01-25T18:58:01Z",
"lang": "en-US",
"results": {
"span": [
{
"id": "yfs_l10_audmxn=x",
"content": "13.8172"
},
{
"id": "yfs_l10_audmxn=x",
"content": "13.8172"
}
]
}
}
}
Jquery的
<script>
$(function(){
$.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fmx.finance.yahoo.com%2Fq%3Fs%3DAUDMXN%3DX%22%20and%0A%20%20%20%20%20%20xpath%3D'%2F%2F*%5B%40id%3D%22yfs_l10_audmxn%3Dx%22%5D'&format=json&callback=", function(data){
$('#currency').html(data.query['results'].span);
});
});
</script>
tnks =)
答案 0 :(得分:1)
货币信息在那里。我不知道你为什么看不到它。
也许你应该使用它,
$('#currency').html(data.query['results'].span[0].content);
data.query['results'].span[0].content
包含13.8172
这意味着MXN 1 = AUD 13.8172
答案 1 :(得分:0)
$(function(){
$.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fmx.finance.yahoo.com%2Fq%3Fs%3DAUDMXN%3DX%22%20and%0A%20%20%20%20%20%20xpath%3D'%2F%2F*%5B%40id%3D%22yfs_l10_audmxn%3Dx%22%5D'&format=json&callback=", function(data){
$("span").html(data.query.count);
$("#created").html(data.query.created);
$("#lang").html(data.query.lang);
$(data.query.results.span).each(function(index,elem){
$.each(elem,function(k,v){
$("<tr/>").append("<td> "+k+" </td><td> "+v+" </td>").appendTo("table");
})
});
});
});