ajax error at firefox, it keep saying

httpRequest is not defined
[Break on this error] if(httpRequest.readyState == 4 || httpRequest.readyState=="complete"){

How can i solve this problem. any advise?

    Tough to say without a page link or at least seeing the JavaScript you are using.

      A shot in the dark but....

      Did you initialize the XMLHttpRequest or ActiveXObject correctly? I.e. do you have somewhere:

      if(window.XMLHttpRequest)
      {
          httpRequest = new XMLHttpRequest();
      }
      else if (window.ActiveXObject)
      {
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
      }

        is it normal when ajax keep running..

        i encounter ajax error at firefox error console
        Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://www.domain.com/js/ajax.js :: handleResponse2 :: line 143" data: no]

        function getXmlHttpRequest()
        {
        	var httpRequest = null;
        	try
        	{
        		httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
        	}
        	catch (e)
        	{
        		try
        		{
        			httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        		}
        		catch (e)
        		{
        			httpRequest = null;
        		}
        	}
        	if (!httpRequest && typeof XMLHttpRequest != "undefined")
        	{
        		httpRequest = new XMLHttpRequest();
        	}
        	return httpRequest;
        }
        
        // Make the XMLHttpRequest object 
        var httpRequest=false;
        
        
        // Make the XMLHttpRequest object 
        var http=getXmlHttpRequest();
        
        function sendRequest(str,) { 
           http.open('get','clicks.php?task=hear&id='+str); 
           http.onreadystatechange = handleResponse; 
           http.send(null); 
        } 
        
        function handleResponse() { 
        
           if(http.readyState == 4 && http.status == 200){ 
        
          // Text returned FROM the PHP script 
          var response = http.responseText; 
          if(response) { 
              document.getElementById("txtHint").innerHTML = response; 
              } 
        
           } 
        } 
        

          There are many theories to where that error comes from...

          One
          Another
          A Bug report for Mozilla
          And another

          Just google for NS_ERROR_NOT_AVAILABLE +nsIXMLHttpRequest.status and that will turn up a bunch of results for you.

          If you can't get this sorted, what you may think about doing is utilizing some of the premade AJAX classes like jQuery or Prototype

            Write a Reply...