【发布时间】:2014-02-18 09:54:45
【问题描述】:
我想使用 jquery ajax get 方法调用 Web 方法。但它没有被调用。在我的 javascript 和代码下方
javascript:
function RetrievePassword() {
var forgotEmail = $("#txtForgotEmail").val().trim();
//call the ajax method to retrieve the password from the email address provided.
$.ajax({
type: "GET",
url: "test.aspx/RetrievePassword?email=" + forgotEmail,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
alert(result.d);
},
error: function () {
alert("Error while calling the server!");
}
});
}
我的函数背后的代码
[WebMethod]
[ScriptMethod(UseHttpGet=true)]
public static string RetrievePassword(string email)
{
//some code
}
有人可以帮我解决这个问题吗..
【问题讨论】:
-
你确定你包括
j-query参考?
标签: jquery asp.net get-request