请让我知道我在这里做错了什么?
$.ajax({
type: "POST",
url: "index.aspx/check_phone_no_server",
data: "{'Email':'" + $('#phoneno').val() + "'}",
async: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert(response.d);
if (response.d != "0")
alert("1 is heere");
else {
alert("0 is heere");
}
}
});
[System.Web.Services.WebMethod]
public static string check_phone_no_server(string Email)
{
//index a = new index();
//return a.check_phone_no();
return Email.ToString();
}
答案 0 :(得分:0)
您只需将数据作为Object
传递,而不是String
:
$.ajax({
type: "POST",
url: "index.aspx/check_phone_no_server",
data: {
Email: $('#phoneno').val() //will probably not be phoneno
},
async: false,
dataType: "json",
success: function (response) {
alert(response.d);
if (response.d != "0")
alert("1 is heere");
else {
alert("0 is heere");
}
}
});