jquery使用ajax方法调用webservice

jquery使用ajax方法调用webservice

ID:1357341

大小:505.50 KB

页数:26页

时间:2017-11-10

jquery使用ajax方法调用webservice_第1页
jquery使用ajax方法调用webservice_第2页
jquery使用ajax方法调用webservice_第3页
jquery使用ajax方法调用webservice_第4页
jquery使用ajax方法调用webservice_第5页
资源描述:

《jquery使用ajax方法调用webservice》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、jQuery使用Ajax方法调用WebService在这里将jQuery使用Ajax调用WebService的几个常用的方法做了一个整理,提供给正在找这方面内容的博友,希望能给学习jQuery的朋友一点帮助。ws.aspx代码

2、nat="server">.hover{cursor:pointer;/*小手*/background:#ffc;/*背景*/}.button{width:150px;float:left;text-align:center;margin:10px;padding:10px;border:1pxsolid#888;}#dictionary{text-align:center;font-s

3、ize:18px;clear:both;border-top:3pxsolid#888;}#loading{border:1px#000solid;background-color:#eee;padding:20px;margin:100px00200px;position:absolute;display:none;}#switcher{}//无参数调用$(document).ready(function(){$('#btn1').click(function(){$.ajax({type

4、:"POST",//访问WebService使用Post方式请求contentType:"application/json",//WebService会返回Json类型url:"WebService1.asmx/HelloWorld",//调用WebService的地址和方法名称组合----WsURL/方法名data:"{}",//这里是要传递的参数,格式为data:"{paraName:paraValue}",下面将会看到dataType:'json',success:function(result){//回调函数,result,返回值$('#dictionary

5、').append(result.d);}});});});//有参数调用$(document).ready(function(){$("#btn2").click(function(){$.ajax({type:"POST",contentType:"application/json",url:"WebService1.asmx/GetWish",data:"{value1:'心想事成',value2:'万事如意',value3:'牛牛牛',value4:2009}",dataType:'json',success:function(result){$('#dic

6、tionary').append(result.d);}});});});//返回集合(引用自网络,很说明问题)$(document).ready(function(){$("#btn3").click(function(){$.ajax({type:"POST",contentType:"application/json",url:"WebService1.asmx/GetArray",data:"{i:10}",dataType:'json',success:function(result){$(result.d).each(function(){//alert

7、(this);$('#dictionary').append(this.toString()+"");//alert(result.d.join("

8、"));});}});});});//返回复合类型$(document).ready(function(){$('#btn4').click(function(){$.ajax({type:"POST",contentType:"application/json",url:"WebService1.asmx/GetClass",data:"{}",dataType:'json',success:function(r

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。