ASP.NET 1.1 Web服务和放大器; jQuery的 [英] ASP.NET 1.1 Web Services & jQuery

查看:126
本文介绍了ASP.NET 1.1 Web服务和放大器; jQuery的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一个1.1 Web服务的一个例子使用jQuery获取调用。我想调用Web服务并传递一些参数给它。

I've been looking for an example of a 1.1 web service getting called using jQuery. I'd like to call a web service and pass a few parameters to it.

有人能指出我在正确的方向?

Can someone point me in the right direction?

谢谢!

推荐答案

没有Web服务上的更多详细信息,通用答案是的使用AJAX调用。下面的例子将在JSON格式的数据,并检索JSON数据备份。

Without more details on the web service, the generic answer is "use an AJAX call". The example below sends data in a JSON format, and retrieves JSON data back.

$.ajax({
  type: "POST",
  url: "theWebServiceURL",
  data: {'key1':'value1','key2':'value2'},
  dataType: /* depends on the return of the web service */,
  success: function(data) { /* do stuff here */ };
});

有一些特殊性,有时发送数据,如果需要发送数据。

There are some peculiarities sometimes on sending the data, if you need to send data.

更新:鉴于约翰Saunder的帖子,我想我会在最后一句扩大。 ASP.NET v1.1的接受(默认)HTTP GET,HTTP POST或HTTP上的SOAP。什么一个特定的网络服务被设定为基本上接受决定了整个AJAX请求必须如何被发送到web服务。使用jQuery,您主要会去HTTP GET或HTTP POST。 (除非你看中并设置过程数据:假然后创建并发送SOAP格式(XML)的数据和内容类型设置为正文/ XML ,但我从来没有这样做,所以我不能确定的细节。)

UPDATE: Given John Saunder's post, I thought I'd expand on the last sentence. ASP.NET v1.1 accepts (by default) HTTP GET, HTTP POST or HTTP SOAP. What one particular web service is set to accept basically dictates how the whole AJAX request must be sent to the web service. Using jQuery, you are mainly going to go to HTTP GET or HTTP POST. (Unless you get fancy and set processData: false. You then create and send your SOAP-formatted (XML) data and set content-type to text/xml, but I've never done this, so I am unsure of the details.)

这篇关于ASP.NET 1.1 Web服务和放大器; jQuery的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆