這是我的ajax調用。從我的例子網址錯誤:: jQuery不叫
{
"response": [{
"attributes": {
"type": "enge",
"url": "/services/data/v24.0/sobjects/Challenge__c/a0GZ0000005Vvh4MAC"
},
"name": "Really",
"end_date": "2013-02-07T15:26:00.000+0000",
"total": 350.0,
"registered_members": 0.0,
"id": "30",
"type": "Design",
"id": "a0GZ0000005Vvh4MAC",
"start_date": "2012-11-19T16:52:00.000+0000",
"description": "This is my really cool challenge",
"remaining_days": 28.0,
"categories__r": [{
"attributes": {
"type": "Category__c",
"url": "/services/data/Category__c/a08Z0000000RNI2IAO"
},
"id": "0RNI2IAO",
"display_name": "Andy"
}, {
"attributes": {
"type": "Category__c",
"url": "/services/Category__c/a08Z0000000RNI3IAO"
},
"id": "a0O",
"display_name": "ADR"
}]
}
}],
"count": 1
}
我試圖做一個跨域調用,並得到錯誤
$.ajax({
type: "GET",
url: "http://example.com/v1/search?keyword=r",
dataType: "jsonp",
crossDomain: true,
success: function (responseString) {
alert(responseString);
},
error: function (xhr, errorType, exception) {
var errorMessage = exception || xhr.statusText;
alert(errorMessage);
}
});
響應
jQuery180014405992737595236_1357861668479 was not called
更新
嗯,我試圖使用da taType:「json」,但在此時出現錯誤
No Transport
您的遠程頁面是否發出正確形成的JSONP響應? '回調({/ * json * /})' – Matt
是的,響應是JSON,而不是JSONP。 –
@FelixKling以及我嘗試使用dataType:json,但得到錯誤「無運輸」 – iJade