...

View Full Version : trying to enable calendar for AJAX



codyodell
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);
req.send(null);
// 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);
req.send();
}
}
}

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" +
req.statusText;
}
}
}


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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum