View Single Post
Old Dec 6th, 2007, 1:12 PM   #12
FireflyX
PHP God
 
FireflyX's Avatar
 
Join Date: Nov 2007
Location: Stockton, England
Posts: 15
Rep Power: 0 FireflyX is on a distinguished road
Send a message via MSN to FireflyX
Re: Problem with calling a function

Quote:
You should mention the actual URL so we could look at it not working, or if it is a private page, post your current code. Also, the line number of the error would be a help.
I can't post a link since you have to actually be logged in to use the PMs feature. But here's how the code is at the moment:

<script type="text/javascript">

var xmlHttp;

function initialize(){ 

  try{
    xmlHttp=new XMLHttpRequest();    
  }catch (e){
    try{     
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
    }catch (e){      
      try{        
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
        }catch (e){
          alert("Your browser does not support AJAX!");        
          return false;        
        }      
      }    
    }  
  }

function options(cmd){

initialize();

xmlHttp.onreadystatechange=function()
  {
  if(xmlHttp.readyState == 4)
    {
    document.getElementById("show_box").innerHTML = xmlHttp.responseText;
    }
  }

xmlHttp.open("POST","http://www.staticfire.co.uk/ajaxrequest.php?cmd=" + cmd,true);
xmlHttp.send(null);

}
</script>

Quote:
It's been a while since I've done any work with Ajax, but I believe, by default, Ajax is browser dependant, so you must include an external .js file that will work out the compatibility for you. Feel free to correct me of course...
 try{
    xmlHttp=new XMLHttpRequest();    
  }catch (e)
But this code should create the built in javascript object that firefox uses. As for Netscape i'm unsure whether that uses the js object or the activex object but my code should create whichever is needed therefore making it compatible with all major browsers.
__________________
mysql_query("DELETE chavs FROM earth") or die("chavs");
FireflyX is offline   Reply With Quote