我正在嘗試使用下面的代碼進行Ajax調用。相同的代碼適用於閃爍r api。但不知道爲什麼這不起作用,並返回此網址的任何結果。有人可以幫忙嗎?Ajax調用不返回任何數據
var URL2='https://www.ibm.com/gateway/?&cc=br&lc=pt&format=json&ts=1340215931434&type=getExpertProfile&userid=30469&cb=200:displayData';
$.ajax({
url: URL2,
// contentType: "application/json; charset=utf-8",
dataType: "jsonp",
jsonp: "callback",
jsonpCallback: "jsonpCallbackfunction",
success: function (data) {
console.log('on success!');
console.log(data);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log('on error!');
console.log("xhr.status: " + xhr.status);
console.log("xhr.statusText: " + xhr.statusText);
console.log("xhr.readyState: " + xhr.readyState);
console.log("textStatus: " + textStatus);
console.log("errorThrown: " + errorThrown);
console.log("xhr.redirect: " + xhr.redirect);
}
});
你正在做* POST *的權利?也許是由於使用'jsonp'... – 2014-09-01 20:31:28
你有'url:'URL2''而不是'url:URL2' – Stryner 2014-09-01 20:33:49