以下ajax函数在jquery 1.4.4中有效,但在1.5中没有。我还没有完全掌握$ .ajax 1.5的新功能。我转过身来快速回答。需要改变什么。
function ReceiveAndShowResults(query) {
var bingUri = BuildBingApiUri(query, offset);
$.ajax({
url: bingUri,
success: OnResultsReceived,
error: OnError,
dataType: 'jsonp'
});
}
function BuildBingApiUri(query, offset) {
var bingApiUrl = "http://domain.com/json.aspx";
var bingApiAppId = "12345";
var bingApiImageCount = "25";
var s = bingApiUrl + "?AppId=" + bingApiAppId + "&Sources=image&" + "&Query=" + query + "&Image.Count=" + bingApiImageCount + "&Image.Offset=" + offset + "&JsonType=callback&JsonCallback=?";
return s;
}