首先,导入jquery的js包,这是必须的
其次,语法必须得对。
请求本页面的后台方法注意事项:必须是公开的、静态的、web方法
下面贴代码:
$.ajax({
type: "POST",
contentType: "application/json",
url: "GeneralWorkmenu.aspx/GetComWork",
data: "{}", //这必须得有,无论有没有参数,没有参数就这个样子写,否则会报错的,有参数时这样写(data:"{'参数名':参数值}"),多个参数逗号隔开
dataType: "json",
success: function (msg) {
alert(msg.d);//请求成功后返......
阅读全文