utahcon Posted September 21, 2006 Share Posted September 21, 2006 I am looking through the w3c's guides on AJAX and I found this*** sorry I think I should reword the question *** var xmlHttpfunction showHint(str){if (str.length==0){ document.getElementById("txtHint").innerHTML=""return}xmlHttp=GetXmlHttpObject()if (xmlHttp==null){alert ("Browser does not support HTTP Request")return} var url="gethint.asp"url=url+"?q="+strurl=url+"&sid="+Math.random()xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true)xmlHttp.send(null)} function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ document.getElementById("txtHint").innerHTML=xmlHttp.responseText } } function GetXmlHttpObject(){ var objXMLHttp=nullif (window.XMLHttpRequest){objXMLHttp=new XMLHttpRequest()}else if (window.ActiveXObject){objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")}return objXMLHttp} Couldnt I call a function like callPHP(), that would pass the needed URL into the functions above and have it return the value of xmlHttp.responseText?I am not having any success in doing so... Link to comment Share on other sites More sharing options...
reportingsjr Posted September 21, 2006 Share Posted September 21, 2006 I have my own function that calls ajax. So im guessing what you want is a function where you put callPHP('blah.php', 'var=content'); and get reponseText back? Link to comment Share on other sites More sharing options...
utahcon Posted September 21, 2006 Author Share Posted September 21, 2006 I have my own function that calls ajax. So im guessing what you want is a function where you put callPHP('blah.php', 'var=content'); and get reponseText back?yes exactly... Link to comment Share on other sites More sharing options...
Webworldx Posted September 22, 2006 Share Posted September 22, 2006 Check Chocolate's topic ( http://w3schools.invisionzone.com/index.php?showtopic=7340 ) on page changing. I think you're both basically wanting the same thing - i'll add in my two line loadXMLObject call later there Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now