通过JQuery提供Web服务 [英] Web services through JQuery

查看:80
本文介绍了通过JQuery提供Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

我使用以下jquery来调用我的网络服务。

Hi Friends,
I am using the following jquery to call my web service.

$(document).ready(function () {
           SearchText();
       });
       function SearchText() {
           $(".csSearch").autocomplete({
               source: function (request, response) {
                   $.ajax({
                       type: "POST",
                       contentType: "application/json; charset=utf-8",
                       url: "WebService.asmx/GetCountries",
                       data: "{'prefixText':'" + $('.csSearch')[0].value + "','Flag':'" + $('.cslbl')[0].innerHTML + "','val':'" + $('.csdrpsrc')[0].value + "'}",
                       dataType: "json",
                       success: function (data) {
                           response(data.d);
                       },
                       error: function (result) {
                           alert("Error....." + $('.csSearch')[0].value);
                       }
                   });
               }
           });
       }



如果它在我的一个网络表单中正常工作,但不能在同一个应用程序的另一个Web表单中工作。它没有给我错误,但甚至没有调用我的Web服务方法。

在我使用相同的Web服务和相同的方法的形式。



先谢谢。


In case it happens to be working fine in my one web form but dosen't work in another web form of same application. It dosen't gives me error but does not even invoke my web service method.
In both the form I have used same web service and same method.

Thanks in advance.

推荐答案

(document).ready(function(){
SearchText();
}) ;
函数SearchText(){
(document).ready(function () { SearchText(); }); function SearchText() {


。csSearch)。autocomplete({
source:function(request,response){
(".csSearch").autocomplete({ source: function (request, response) {


.ajax({
type: POST
contentType: application / json; charset = utf-8
url: WebService.asmx / GetCountries
data: {'prefixText':' +
.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "WebService.asmx/GetCountries", data: "{'prefixText':'" +


这篇关于通过JQuery提供Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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