使用JQuery检索JSON [英] Retrieving JSON with JQuery
本文介绍了使用JQuery检索JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用JQuery从以下位置检索JSON: http://www.chirpradio.org/json
I'm trying to retrieve JSON with JQuery from: http://www.chirpradio.org/json
如何在网页中检索,解析和显示JSON.
How do I retrieve, parse and display that JSON in a web page.
我是JSON和JQuery的新手,现场文档有点难以理解.
I'm new to JSON and JQuery, and the onsite documentation is a bit difficult to follow.
谢谢
仪式
推荐答案
一种克服SOP的方法是使用代理(,该代理还将其转换为JSONP ).即:
One way to get past the SOP is to use a proxy(which also converts it into JSONP). i.e.:
var url = "http://www.chirpradio.org/json";
jQuery.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D%22"+url+"%22&format=json&callback=?", function(data){
console.log(data.query.results.json);/*where yahoo puts the json object*/
});
但是,我建议不要查询带有敏感信息的信息(这是不安全的).可以,您可以使用收音机供稿.
However, I suggest not to query w/sensitive information(it's insecure). Your use with the radio feed is ok though.
这篇关于使用JQuery检索JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文