Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ale Ale

    Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)

    I've got the same problem with firefox. My web app works correctly on IE, but in firefox catch an exception like this:

    uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILU RE) [nsIXMLHttpReque st.send]" nsresult: "0x80004005 (NS_ERROR_FAILU RE)" location: "JS frame :: file:///C:/Users/workspace/request.js :: sendRequest :: line 48" data: no]

    Code:
    # function sendRequest(url,params)
    #         {                      
    # var http = getXMLHttp();
    var response=null;   http.open("GET",url,false);                          http.onreadystatechange=function() {
    #               if (http.readyState==4) {
    #                        response = http.responseText;
    #                                       }
    #                                  };    
    # http.send();   
    # }
    #  
    #  
    # function getXMLHttp() {
    #              var xmlhttp = null;
    #                 if (window.ActiveXObject) {
    #                    if(navigator.userAgent.toLowerCase().indexOf("msie5")!=-1)                  {
    #              xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    #                     } else {
    #              xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    #                     }
    #                   }
    #            if(!xmlhttp&&typeof(XMLHttpRequest)!='undefined') {
    #                     xmlhttp = new XMLHttpRequest();
    #                   }
    #                   return xmlhttp;
    #                   }
    Someone can help me?
    Thanks in advance
    Ale
    Last edited by MMcCarthy; Oct 17 '10, 10:49 PM. Reason: added code tags and split from old thread
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Since it's an synchronous request, there's no need for onreadystatecha nge because the browser will wait for a response before handing back to the script. So, response = http.responseTe xt; can go after the send() call.
    Last edited by Dormilich; Oct 18 '10, 09:55 AM. Reason: correcting typo

    Comment

    Working...