Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy Fix?

Status
Not open for further replies.

mryanmay

Programmer
Feb 13, 2008
1
US
Basically, what I want to happen is I want to have an empty div populate with a table displaying live statistics. I have the code written for that and basically want to call the .php page to refresh inside this div. Here is what I have:
_________________________________________________
<script language="javascript" type="text/javascript">
var url = location.href;

window.onload = setInterval('ajaxFunction();',10000);
<!--
//Browser Support Code
function ajaxFunction(){
var ajaxRequest;

try{
// Opera, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// IE
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Please Try Your Request Again Later");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
ajaxRequest.open("POST", 'ajaxDiv', true);
ajaxRequest.send(null);
}

//-->
</script>

<div id="ajaxDiv">
</div>

______________________________________________________


So basically I want to inject my .php file inside the div and show its contents. Currently it injects the index page after the first 10 seconds. What would be great is if I could take the current URL and strip it of the file reference and replace it with the .php file. i.e.:

to
(contains the table with php functions)

and then point the div to repopulate with the php url inside the div. It ( needs to be dynamic because this is on an enterprise app. What do you guys have?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top