Hello again, I put in some ajax code, and am calling two different functions when a div is clicked. What it is supposed to do is replace two different divs content on the page. For example, when the button is clicked, it will change a div on the left to display "Left text", and the div on the right to display "right text". When I click the button, it just executes one of the functions into both divs, and displays "right text" into both of the div's.. Does anyone know what I am doing wrong? I hope this is enough information.. Thanks for any help!
Here's my code:
HTML Code:
<div id="div1" onclick="viewUpdates(); UpdatesTools();">Updates</div>
PHP Code:
function viewUpdates() { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("other").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","page.php",true); xmlhttp.send(); }
function UpdatesTools() { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("rightbodytools").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","page2.php",true); xmlhttp.send(); }
-Dillon
Last edited by Dillon; 07-02-2010 at 04:31 PM..
|