gpt4 book ai didi

jquery - 为什么我的 YQL 查询在 jQuery 中返回空结果,而相同的 YQL 查询在 YQL 控制台返回正值?

转载 作者:行者123 更新时间:2023-12-01 06:06:55 26 4
gpt4 key购买 nike

假设我有一个像这样的 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(意外)。

最佳答案

我点击了 jsbin 链接,在 Windows 上运行的 Chrome 中一切正常。您应该验证当前浏览器是否确实支持 JSON.stringify 方法,如果不支持,请使用库 ( https://github.com/douglascrockford/JSON-js/ )。

关于jquery - 为什么我的 YQL 查询在 jQuery 中返回空结果,而相同的 YQL 查询在 YQL 控制台返回正值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4811957/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com