我怎样才能为jquery jsonp编写这个YQL语句
我正在尝试使用 YQL 和 Jquery 做一些跨域的事情,但我在让这个 yql 查询正常工作时遇到了一些麻烦。
好的,这是我正在尝试开始工作的 YQL 语句:
use 'http://yqlblog.net/samples/data.html.cssselect.xml' as data.html.cssselect; select * from data.html.cssselect where url="www.holylandmoments.org/devotionals/the-sabbath-experience" and css="#main-content p"
现在,我正在尝试更改以适应我正在尝试做的事情的 yql 语句是:
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + site + '"') + '&format=xml&callback=?';
从我读到的内容中,以便我能够要选择 CSS 选择器,我需要调用一个开放的数据表。
我不知道如何更改示例 yql 语句以将 USE 和 AS 包含到查询中。
任何帮助都可以。
I'm trying to do some cross domain stuff with YQL and Jquery but i'm having a little trouble with getting this yql query to work right.
Okay so this is the YQL statement i'm trying to get to work:
use 'http://yqlblog.net/samples/data.html.cssselect.xml' as data.html.cssselect; select * from data.html.cssselect where url="www.holylandmoments.org/devotionals/the-sabbath-experience" and css="#main-content p"
Now the yql statement that I am trying to change to suit what i'm trying to do is:
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + site + '"') + '&format=xml&callback=?';
From what i've read in order for me to be able to pick and choose css selectors I need to invoke an open data table.
I don't know what or how I can change the example yql statement to include the USE and AS into the query.
Any help would do.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,我明白了...如果其他人需要这样的东西,请看一下:
function requestCrossDomain( site, callback ) {
Okay I got it... if anyone else needs something like this take a look:
function requestCrossDomain( site, callback ) {
请参阅下面的示例,了解如何从 YQL JSONP 获取新闻
see the below example of how to get the news from YQL JSONP
http://www.techtricky.com/jquery-code-to-display-top-news-using-yql-jsonp-api-service/