XMLHttpRequest.Send() not working in mozilla FireFox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gurudatt Kumar
    New Member
    • Oct 2011
    • 1

    XMLHttpRequest.Send() not working in mozilla FireFox

    Hi, I am trying to access webservice and fetch information through its webmethod through Javascript. But this is unable to send XML to webservice url in FireFox browser.

    Though this is working fine in IE.

    Code:
    <script type="text/javascript">
    
        var XMLcode = "";
    
        function loadXMLData() 
    
        {
    
     
    
      if (window.XMLHttpRequest) {
    
            a = new XMLHttpRequest();      
    
        }
    
        else {       
    
            var a = new ActiveXObject("Microsoft.XMLHTTP");
    
        }   
    
        a.open("POST", "http://10.10.22.133:5680/PPService.asmx", false);
    
        a.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    
        a.setRequestHeader("SOAPAction", "http://www.xyz.com/GetMessage");
    
        var d = '<?xml version="1.0" encoding="utf-8"?>' +
    
            +'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">'
    
            + '<soap:Body>'
    
            + '<GetMessage xmlns="http://www.xyz.com/" />'
    
            + '</soap:Body>'
    
            + '</soap:Envelope>';
    
        alert("XML created");
    
        a.onreadystatechange = handleSendUpdateReponse;
    
        if (a.readyState == 4) { // readyState, see below
    
            alert("Ready1");
    
            container.innerHTML = request.responseText;
    
        }
    
        if (a.status == 200) {      
    
            alert(a.responseText);
    
            }
    
            a.send(d);
    
     XMLcode = a.responseText;
    
            alert(XMLcode);
    
    }
    Can you please suggest the solution of this issue as this generates exception as below:

    uncaught exception: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_A VAILABLE) [nsIXMLHttpReque st.status]" nsresult: "0x80040111 (NS_ERROR_NOT_A VAILABLE)" location: "JS frame :: http://localhost:57157/Users/gkuma3/Desktop/BindList-II.html :: anonymous :: line 52" data: no]



    Thanks in advance!

    Regards,

    Gurudatt
    Last edited by NeoPa; Oct 14 '11, 01:21 PM. Reason: Added mandatory [CODE] tags for you
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    since you use the XMLHttpRequest in sync mode the lines 43 - 57 doesn't make any sense, since you try to do someting with the request-response before the request is even sent.

    Comment

    Working...