How to use ajax post in web forms?
$.ajax({
type: "POST",
url: "frmMailRules.aspx/DeleteMailRuleItem",
data: "{ MailRuleItemId: 104 }",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
debugger;
// Replace the div's content with the page method's return.
$("#Result").text(msg.d);
}
});
<WebMethod()>
Public Shared Function DeleteMailRuleItem(ByVal MailRuleItemId As Integer) As String
Dim a As String = "temp"
DeleteMailRule()
Return a
End Function
Protected Sub DeleteMailRule()
End Sub
its giving me error -
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.