0
我们正试图从网站上消费饲料。我们已经尝试了不同的方法,但他们都不工作:jQuery饲料加工
方法1:试图获取内容并手动解析它
$.get("http://www.wwe.com/feeds/sapphire/news/all/all/0,1", {}, function(data){
alert(data);
});
我们总是得到一个空的响应。如果粘贴在浏览器窗口中的网址,你得到一个有效响应(http://www.wwe.com/feeds/sapphire/news/all/all/0,1)
方法二:使用JSONP
我们有这样的代码:
$.ajax({
url: "http://www.wwe.com/feeds/sapphire/news/all/all/0,1",
dataType: 'jsonp',
data: {},
error: function (jqXHR, textStatus,errorThrown) {
console.log("error");
},
contentType: "application/json",
success: function (data, textStatus, jqXHR) {
console.log('success_function');
console.log(data);
}
});
服务器与无效的标签响应。看起来在响应回调函数丢失。 任何帮助将不胜感激。
让我猜测,您的控制台中会出现Access-Control-Allow-Origin警告? – 2013-03-26 21:09:11
不,我们得到SyntaxError:无效标签。有什么办法可以得到未解析的字符串? – Ezequiel 2013-03-26 21:12:51