我打電話我的網頁的方法失敗:
var dfd = $.Deferred(
$.getJSON(serviceAddress)
.done(function (result, status) {
bo.BusinessObject.DtosToaKoArray(result, resultList);
dfd.resolve(resultList);
})
.fail(function (result, status) {
logger.logError(result);
dfd.reject(result);
}));
return dfd;
調用JSON後,螢火顯示的HttpRequest是全成和響應頭是這樣的:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?RDpcV29ya3NwYWNlc1xNZWhyYW5cSW5mcmFzdHJ1Y3R1cmVcTWFpblxTb3VyY2VcSW5mcmFzdHJ1Y3R1cmVcU291cmNlXENhcmFuZS5HYWxheHkuV2ViQXBpXGFwaVxEYXRhUHJvdmlkZXJcTGlzdFNlcnZpY2Vc?=
X-Powered-By: ASP.NET
Date: Sun, 04 Aug 2013 05:57:39 GMT
Content-Length: 6684
但問題在於不是done
回調,該回調fail
被稱爲這個結果:
Object { readyState=4, status=404, statusText="error"}
我的電話沒有成功的http請求失敗,這是怎麼回事?
Edit1。
我的網站(MyApp.Web)是在localhost:2771和呼叫服務是在本地主機上另一個項目(MyApp.WebApi):4143
你的預期響應是什麼,請問一些服務器代碼? –
@JonathanLonowski我已經完全刪除了延遲部分,只是稱爲'getJSON'部分。但問題仍然存在。 – mehrandvd
@Hemant_Negi我希望調用'done'函數(因爲它是一個成功的響應),結果將是返回的json。 – mehrandvd