0
我有Web服務,我從jQuery調用它,一切正常,直到我仍然在同一臺服務器上,但是當我嘗試從其他域調用該服務時,我什麼也沒有得到請有人幫助我。以下是我的代碼:jQuery + Web服務+跨域
$.ajax({
type: 'POST',
url: 'http://-----------/Service.asmx/BulkUpdate',
data:"{'CaseID': '"+CaseID+"'}",
contentType : "application/json; charset=utf-8;",
"dataType" : "json",
success: function(xData, status)
{
alert(xData.d);
}
,error : function(xhr)
{
alert(xhr.responseText);
}
});
Santosh我已經嘗試過「dataType」:「JSONP」這個,它沒有工作,你能告訴我如何配置我的服務器允許來自其他域的請求。 – codery2k
當您使用JSOP時會得到什麼錯誤,您是否嘗試記錄錯誤。與JSONP它應該工作。否則你必須在你的Web服務項目中做請求頭配置。 @ codery2k –