jquery执行具体的方法
来源:互联网 发布:最新个人业务网站源码 编辑:程序博客网 时间:2024/04/26 09:28
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $.ajax({ type: "POST", contentType: "application/json", url: "JqueryDemo.aspx/GetUserName", data: "{}", dataType: "json", success: dd, error: function(x, e) { alert("e") } }); }); function dd(result) { alert(result.d) } </script>
//[webmethod(enablesession = true)]//或[webmethod(true)] [WebMethod] public static string GetUserName() { return "234"; }