【发布时间】:2014-11-20 17:54:26
【问题描述】:
我有 ajax 调用:
$.ajax({
type: "POST",
url: "http://localhost:95/MobileEcomm/Service1.svc/validateLogin",
crossDomain: true,
data:{ 'EmailID':EmailID, 'Password':Password},
success: function (data) {
alert(data);
// do something with server response data
},
error: function (err) {
// handle your error logic here
alert("Error");
}
});
我想调用:
[WebInvoke(
Method = "POST",
BodyStyle = WebMessageBodyStyle.Wrapped,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
UriTemplate = "validateLogin/{Email}/{Password}")]
[OperationContract]
string validateLogin(string Email, string Password);
但我总是进入 ajax 的错误块。
我的 ajax 调用有什么错误?
错误1:
错误 2:
【问题讨论】:
-
你确定 phonegap 应用可以访问你的 localhost:95 服务器吗?
-
是的,它的纯 html 代码 @VsevolodGoloviznin
-
@CuteChild 我的意思是通常无法通过网络访问 localhost 环境
-
@VsevolodGoloviznin 我在 IIS 中托管了服务
-
@EhsanSajjad 我发布了错误
标签: javascript c# jquery .net ajax