I am trying to pass an element’s id to an ajax function so that I can update different areas by passing different ids to the same function, but I am not quite sure how to get it passed to where I want it to go.
[code]
function calGet(date,month,year,id,action) {
xmlHttp=GetXmlHttpObject();
if(xmlHttp==null) {//ajax won’t work, redirect to a calendar php page to display the event with php
window.location = “localhost/panl/eventCalendar.php?date=”+date+”&month=”+month+”&year=”+year;
return;
}
var url = “http://localhost/panl/scripts/calendar.php”;
url=url+”?date=”+date+”&month=”+month+”&year=”+year+”&run=”+action;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open(“GET”,url,true);
xmlHttp.send(null);
}
function stateChanged() {
if(xmlHttp.readyState==4) {
document.getElementById(‘calEvent’).innerHTML=xmlHttp.responseText;
}
}
In the function calGet I passed a parameter ‘id’. I want to get this parameter down into the getElementById area in the stateChanged function and I’ve tried, many many ways, but I cannot figure it out.