Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi Friends,
I am using the following jquery to call my web service.
C#
$(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);
                       }
                   });
               }
           });
       }

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.
Posted
Updated 1-Jul-14 0:30am
v2
Comments
According to the URL ("WebService.asmx/GetCountries"), it assumes that the Web Form and Service are in same directory. Are they in the same directory?
SRS(The Coder) 1-Jul-14 9:19am    
You can go for the developer tool to see the exact cause for it.

For any browser open the page and press 'F12', it will open the Developer's tool for the browser.
Now open the Console tab and do the operation to call the ajax method.
It will view the error if any to fix.

Hope this will be helpful for you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900