我試圖使用jQuery獲取www.google.com/movies的響應文本。谷歌網站上的jQuery
我從$.load
試圖$.get
,$.ajax
,等...
任何人都可以告訴我,如果這是可能的嗎?
我的一些失敗的嘗試:
$(document).ajaxError(function() {
alert('ajax error');
});
$(document).load("http://www.google.com/movies?near=joinville,Santa+Catarina,Brazil", null, function (responseText) {
alert("Response:\n" + responseText);
});
$.getJSON("http://www.google.com/movies?near=joinville,Santa+Catarina,Brazil&callback=?",
function (responseText) {
if (responseText)
alert("Response:\n" + responseText);
else
alert("fail");
}
);
$.get("http://www.google.com/movies?near=joinville,Santa+Catarina,Brazil",
null,
function (responseText) {
if (responseText)
alert("Response:\n" + responseText);
else
alert("you fail again");
}
);
$.ajax({
cache: false,
url: "http://www.google.com/movies?near=joinville,Santa+Catarina,Brazil",
dataType: 'html',
success: function (responseText) {
if (responseText)
alert("Response:\n" + responseText);
else
alert("you fail again");
}
});
使用谷歌的搜索API http://code.google.com/apis/ajaxsearch/ – Adam 2010-08-11 00:22:44