Jump to content

New To Ajax


shark1234

Recommended Posts

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.