Search code examples
jqueryasp.netwcfwcf-bindingwcf-client

call External webservice using jquery?


I developed asp.net WCF service.I have hosted it in another system.now i need to get the WCF webservice to my System using JQUERY Function.my problem is I dnt knw how to call that webservice hosted in another system.How to call external webservice from jquery?


Solution

  • You can just use the AJAX jQuery method:

    $.ajax({
      url: 'http://localhost:4305/Service/YourService',
      type: "GET",
      success: function(data) {
         alert('WCF service called');
      }
    });
    

    There is also an article on Code Project to achieve this with WCF.

    http://www.codeproject.com/Articles/128478/Consuming-WCF-REST-Services-Using-jQuery-AJAX-Call

    http://api.jquery.com/jQuery.ajax/