【发布时间】:2011-01-27 00:59:35
【问题描述】:
假设我有一个这样的 YQL 查询(事实上,这正是我正在使用的查询):
select * from xml where url="http://blog.artbeads.com/feed/"
and itemPath="//rss/channel/item"
Run this query on the YQL Console 它应该返回 10 个项目。
现在考虑以下 jQuery(这几乎是我用于生产的确切代码,除了成功调用,但我不认为这是一个重要因素):
// Working example at http://jsbin.com/ekomi4
$.ajax({
url: 'http://query.yahooapis.com/v1/public/yql',
dataType: 'jsonp',
data: {
q: 'select * from xml where url="http://blog.artbeads.com/feed/" and itemPath="//rss/channel/item"',
format: 'json'
},
success: function(content) { $('#content').text(JSON.stringify(content, null, ' ')) }
})
上述代码未按预期执行:返回 JSON 对象(如预期),但 query.results = null(意外)。
【问题讨论】:
-
尝试使用 curl -v 或 wget 获取有关请求的调试信息