I am creating a calendar that is loaded via AJAX, so the page does not load when click previous or next month button. Within the calendar I include another AJAX on each cell, that will show the clicked cell date. I got homepage (include calendar.php, javascript.js), when homepage is execute, there is no javascript run when I click on the calendar cell. It works when I only run calendar.php by itself.
How do I get the javascript to run inside the AJAX?
The javascript within the calendar.php, this code is stored inside javascript.js
function loadXMLDoc(var1)
{
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("myDiv").innerHTML=xmlhttp.responseText;
}
}
var passingID1 = var1;
var url = "variables.php";
var modurl = "variables.php?passid=" + passingID1;
xmlhttp.open("GET", modurl ,true);
xmlhttp.send();
}
My homepage
<body onLoad='navigate("","")'>
<div id="calback">
<div id="calendar">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</div>
</div>
<p>Selected Date
<div id="myDiv"><h2>You have selected !</h2></div>