前台:
 
 1 $.ajax({
 2     url: "TransBloodRequisition.aspx/aaa",//页面后台带方法名
 3     contentType: "application/json",//必须为application/json
 4     type: "POST",//必须为POST
 5     data: "{  }",//格式为 "{a:1,b:2}"
 6     dataType: "json",//必须为json
 7     success: function (result) {
 8     alert(result.d)
 9     }
10     })
View Code

 

后台:
 
1  [WebMethod(EnableSession= true)]
2         public static string aaa()
3         {
4             return "bb" ;
5         }
View Code

 

//EnableSession= true 使用session
//有参数时 后台参数名称和前台传的参数必须一致,顺序可以不一致
posted on 2014-08-22 13:06  caixiaogui  阅读(1077)  评论(0编辑  收藏  举报