View Full Version : trying to enable calendar for AJAX

10-11-2006, 09:18 PM
We have a calendar on the front ohttp://www.noxiousx.net/index.php but we want to convert it to ajax(as well as a few other things) so that when you change the month it doesnt refresh the page. I've tried a simple JAH function but it ends up going to the actual file of the calendar when you try to change months, I think this is because Im specifying the destination div as the div that the calendar and the function call is actually in but I don't know how else I can set it up. Does anyone have an idea of how I can do this? Here is the JAH function I used:

function jah(url,target) {
// native XMLHttpRequest object
document.getElementById(target).innerHTML = '<img src="images/loading.gif">';
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = function() {jahDone(target);};
req.open("GET", url, true);
// IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = function() {jahDone(target);};
req.open("GET", url, true);

function jahDone(target) {
// only if req is "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
results = req.responseText;
document.getElementById(target).innerHTML = results;
} else {
document.getElementById(target).innerHTML="jah error:\n" +

If you need me to post the php file for the calendar I can.