Click here to Skip to main content
15,921,841 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I have web service on my host having URL http://192.168.1.127:9009/service1.asmx[^]. This webservice has a method getChannel() which returns a string. How can I call this from my project? I tried as follows but it's not working.
JavaScript
<script type="text/javascript">
      $(document).ready(function () {
          $("#sayHelloButton").click(function (event) {
              $.ajax({
                  type: "GET",
                  url: "http://192.168.1.127:9009/service1.asmx/get_voda_channels",
                  data: "{'name': '" + $('#name').val() + "'}",
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: function (msg) {
                      AjaxSucceeded(msg);
                  },
                  error: AjaxFailed
              });
          });
      });
      function AjaxSucceeded(result) {
          alert(result.d);
      }
      function AjaxFailed(result) {
          alert(result.status + ' ' + result.statusText);
      }  
  </script>

Please help me out here.
Posted
Updated 27-May-11 5:59am
v3
Comments
AspDotNetDev 27-May-11 13:09pm    
Just one comment. You set the dataType to "json", but your web service is probably returning XML in a SOAP response.
Wonde Tadesse 27-May-11 21:36pm    
The webservice method is getchannel but you are calling get_voda_channels ? Humm...

1 solution

 
Share this answer
 

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