0
代码隐藏:Web方法只有标记为静态的作品,否则不
[ScriptMethod]
[WebMethod]
public string SavePassword(string password, string username, string resellerId, string isPasswordReset)
{
return null; // For example
}
JavaScript的:
$.ajax({
type: 'POST',
url: 'login.aspx/SavePassword',
data: '{"password":"' + passwordInput + '","username":"' + hidusrname + '","resellerId":"' + hidResellerId + '","IsPasswordReset":"' + hidIsPasswordReset + '"}',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (result) { },
error: function() { alert('error');
}
});
public static string SavePassword()
作品public string SavePassword()
不起作用。
如果我改变webmethod为静态,它的作品,如果我不这不工作。
如何在我的页面中使用没有static
方法的web方法?