我想使用 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
}
任何人都可以帮我解决这个问题..