xmlhttprequest, FFox, Hanging on re-call

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • simonB2007
    New Member
    • Jun 2007
    • 1

    xmlhttprequest, FFox, Hanging on re-call

    K,
    I have a Javascript working in IE6, but works in FF2.0.0.4 for a short while than hangs.
    (Win XP)

    Here's how to reproduce:

    (also opens a popup for my own debug data)

    (1)On page open, the request calls to NDR.asp, returns "Art" and populates the navigational tree.
    (2) Click on the '+' next to ART, and the request is called again to return "Caramic" and "Pen-Paint" which are also added to the tree.
    (3) Click on "Ceramic" ... and nothing happens.
    In the debug (pop up) i see that the request object was called to open, and there it hangs forever more !?

    Now the main function for operating the request (f_request) is below, witht the debug lines left in so you can refer to in the pop-up.

    I've started with a .abort() to kill any previous left-overs, hardcoded the send path .... so cant see why 1 call would differ from another ?

    Hope someone can help !!>!

    Many thanks
    Simon


    Code:
    function f_request(s_inData, s_path){
    	if(!s_inData){debug("***false call");return false}
    
    debug("---------------------------------------------  " + s_inData);
     
    	if(qqq){
    		debug("f_request : Aborting & Resusing");
    		qqq.abort();
    	}else{	
    		debug("f_request : Creating New xmlHttpRequest Object");
    	
    		try {qqq = new ActiveXObject("Msxml2.XMLHTTP");} 
    		catch (e) {
    			try {qqq = new ActiveXObject("Microsoft.XMLHTTP");} 
    			catch (e) {qqq = false;}
    	 	}
    		if (!qqq && typeof qqq !='undefined') {
    			try {qqq = new XMLHttpRequest();} 
    			catch (e) {qqq=false;}
    		}
    		if (!qqq && window.createRequest) {
    			try {qqq = window.createRequest();} 
    			catch (e) {qqq=false;}
    		}
    	}
    
    
    	fullPath = "treeIncludes/NDR.asp";
    debug("f_request : opening with path : " + fullPath);
    	qqq.open("POST",fullPath,true);
    debug("f_request : opensuccess");
    	qqq.setRequestHeader("Cache-Control", "no-cache");
    	//qqq.setRequestHeader("Connection", "close");
    	qqq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    	
    	qqq.onreadystatechange=sendDone;
    	qqq.send(s_inData);
    
    debug("f_request : end function");
    }
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    There's no need to call abort() if the call is finished. Only if it's still ongoing, so check if readyState is not 0 before calling abort.

    Comment

    Working...