直接调用aspx.cs后台方法

1.用jquery变量=<%=后台方法%>

2.首先在前端定义控件<asp:scriptmanager ID="Scriptmanager1" runat="server" EnablePageMethods="True"></asp:scriptmanager>注意EnablePageMethods属性为TRUE;

$('#ca').click(function () {
PageMethods.aaa('asdas', function (val) {
console.log(val);
})
});,

在后台的静态方法上面定义[System.Web.Services.WebMethod]

原文地址:https://www.cnblogs.com/zheng510ke/p/4759827.html