Invoking WCF Service through Javascript

10,605

By using XMLHTTP you ARE using ajax.

There's a full example here:

jQuery AJAX calls to a WCF REST Service

Share:
10,605
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    How can I access the WCF Service through JavaScript? My problem is, I have to access the operation contracts through the JavaScript (my website is not Ajax enabled).
    Previously for calling .asmx web services, I am using the following code snippet

    var xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    xmlHttp.open("POST", URL, false);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.send(payload);
    xmlData = xmlHttp.responseXML;
    

    where url is my webservice location.

    Now if I am trying to consume the wcf service in the same manner, I am not able to. Many techies are explaining through AJAX approach, I need an approach without AJAX.