您好,欢迎访问一九零五行业门户网

jQuery调用WebMethod(PageMethod) NET2.0的方法_jquery

本文实例讲述了jquery调用webmethod(pagemethod) net2.0的方法。分享给大家供大家参考,具体如下:
首先必须在webconfig下的system.web节点加入此配置信息

scriptmethod(responseformat = responseformat.json)][webmethod]/// /// 是否允许注册/// /// /// public static memberinfo allowregist(string memberloginid){ return new memberinfo();//由于设置了返回类型是json,所以客户端的jq能够识别 // memberinfobll mi = new memberinfobll(); //if (!mi.existmember(memberloginid)) //return {d:true};//我测试发现,客户段在接收数据的时候,会多了2个双引号,导致转换json格式失败..郁闷 //else //return {d:false};}
$.ajax({ cache:false, type: 'post', contenttype: 'application/json; charset=utf-8', data: {'memberloginid':' + $(#).val() + '}, datatype: 'json', url: 'reg.aspx/getdate', success: function(result,x,y) { alert(result); }, beforesend:function (xhr) { xhr.setrequestheader('if-modified-since', '0'); //this; // 调用本次ajax请求时传递的options参数 }, error: function(e) { debugger; //alert(可能服务器忙没有返回数据,请重试); }});
更多关于jquery相关内容感兴趣的读者可查看本站专题:《jquery遍历算法与技巧总结》、《jquery表格(table)操作技巧汇总》、《jquery拖拽特效与技巧总结》、《jquery扩展技巧总结》、《jquery常见经典特效汇总》、《jquery动画与特效用法总结》、《jquery选择器用法总结》及《jquery常用插件及用法总结》
希望本文所述对大家jquery程序设计有所帮助。
其它类似信息

推荐信息