似乎YQL不再起作用了。所有示例只返回错误警报或什么也没有。 我试图执行此代码并且没有得到任何结果:
(function ($) {
"use strict";
$.queryYQL = function (statement, type, envUrl, callback) {
if ($.isFunction(type)) {
callback = type;
type = "json";
} else if (!type.match(/(json|xml)/)) {
callback = envUrl;
envUrl = type;
type = "json";
} else if ($.isFunction(envUrl)) {
callback = envUrl;
envUrl = undefined;
}
var scheme = (document.location.protocol === "https:" ? "https" : "http"),
url = scheme + "://query.yahooapis.com/v1/public/yql?callback=?",
data = {
format: type,
q: statement
};
if (envUrl === "all") {
envUrl = scheme + "://www.datatables.org/alltables.env";
}
if (envUrl) {
data.env = envUrl;
}
return $.get(url, data, callback, "json");
};
}(jQuery));
var statement = "select * from feed where url='http://google.com'";
$.queryYQL(statement, function (data) {
console.log(data);
});
我没有任何补充,但StackOverflow强迫我添加此行导致'帖子需要更多详细信息'