首页 > 其他 > 详细

Ajax请求C#后台某个方法

时间:2014-08-22 14:24:58      阅读:290      评论:0      收藏:0      [点我收藏+]
前台:
 
bubuko.com,布布扣
 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

 

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

 

//EnableSession= true 使用session
//有参数时 后台参数名称和前台传的参数必须一致,顺序可以不一致

Ajax请求C#后台某个方法

原文:http://www.cnblogs.com/quexianwei/p/3929173.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!