shark1234 Posted September 22, 2009 Share Posted September 22, 2009 Hello, I was just looking for help on how to make an XHR Request to work using to file. I have it working for one file title.php but i cant seem to figure out how to use 2 files if anyone has an idea can you please let me no Thanks alot <script type="text/javascript" src="zxml.js"></script> <script type="text/javascript"> function getRequest() { var oXmlHttp = zXmlHttp.createRequest(); oXmlHttp.open("get","title.php",true); oXmlHttp.onreadystatechange = function () { if (oXmlHttp.readyState == 4) { if (oXmlHttp.status == 200) { displayCustomerInfo(oXmlHttp.responseText); } else { displayCustomerInfo("An error occurred: " + oXmlHttp.statusText); //statusText is not always accurate } } } oXmlHttp.send(null); } function displayCustomerInfo(sText) { var divCustomerInfo = document.getElementById("put_here"); divCustomerInfo.innerHTML = sText; } </script> </head> <body> <br /> <div id="put_here">Click Above to see the time</div> <br /> <div id="theTime">Click Above to see the time</div> </body> </html> Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted September 22, 2009 Share Posted September 22, 2009 Format your code between these you could just add a param to the getRequest() function function getRequest(url) { var oXmlHttp = zXmlHttp.createRequest(); oXmlHttp.open("get",url,true); // use the url var here // the rest of the function } Quote Link to comment Share on other sites More sharing options...
shark1234 Posted September 22, 2009 Author Share Posted September 22, 2009 Thanks alot! illl play around with that and see what i can do Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.