You must Sign In to post a response.
  • Category: ASP.NET

    Not able to call asmx from JS. using asp.net4.5 + IE11

    Hi,

    If I call asmx service from js. I am getting "JavaScript runtime error: Object doesn't support property or method 'useService'" error. Please help. see my code on below

    <script type="text/javascript">
    function LoadService(divID) {
    var service = document.getElementById(divID);
    service.useService("WebServices/GenericFunctions.asmx?WSDL", "Generic");
    }
    </script>


    <body onload="LoadService('service')">
    <form id="form1" runat="server">
    <div ID="service" STYLE="BEHAVIOR:url(WebServices/webservice.htc)"></div>
    </form>
    </body>

    Thanks,
  • #764499
    Can you try the following code

    <script type="text/javascript">
    function LoadService() {

    service.useService("WebServices/GenericFunctions.asmx?WSDL", "Generic");
    }
    </script>


    <body onload="LoadService()">
    <form id="form1" runat="server">
    <div ID="service" STYLE="BEHAVIOR:url(WebServices/webservice.htc)"></div>
    </form>
    </body>

    By Nathan
    Direction is important than speed

  • #764500

    IE 11 will not support for this functionality "useService".

    Following is the link for getting more information
    https://msdn.microsoft.com/en-us/library/ms531034(VS.85).aspx


    By Nathan
    Direction is important than speed

  • #764535
    Hi sadasivam,
    Yes, IE will no longer user "useService" from IE10+.
    Now the better alternative is use of AJAX json as follows:
    function LoadService() {
    {
    $.ajax({
    type: "GET",
    url: "WebServices/GenericFunctions.asmx",//... your webreference/web service URL
    dataType: "json",
    data: "{}", // or use data: JSON.stringify({ szValue: 'John', szVAl2: 'Mac' }),
    contentType: "application/json; charset=utf-8",
    success: function (success)
    {
    alert("Operation successfull!!! Your returned data from webservice is: " + success.d);
    },
    error: function (error)
    {
    alert("Operation failed!!!");
    }
    });
    }
    Hope it helps.
    Regards,
    Shashikant Gurav
    shashikantgurav22@gmail.com


Sign In to post your comments