I'm using this script to re-load a DIV (id = roomdiv) in a room booking page. It works fine, but reloads all rooms in the page - which is slow if there are lots of rooms on the page. What I would like to do is reload an individual room. I think I need to pass the roomno variable from the changeroom function into the stateChanged2 function but I have no idea how to do it. function changeroom(cell,periodno,dayno,weekno,roomno,t) { document.getElementById(cell).innerText="Wait"; document.getElementById(cell).style.color='000000'; document.getElementById(cell).style.fontWeight='bold'; xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="room.asp"; url=url+"?p="+periodno+"&d="+dayno+"&w="+weekno+"&r="+roomno+"&t="+t; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged2; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged2() { if (xmlHttp.readyState==4) { document.getElementById("roomdiv").innerHTML=xmlHttp.responseText; } } Code (markup): I would ultimately like to be able to have this in the statechanged2 function: function stateChanged2(roomno) { if (xmlHttp.readyState==4) { document.getElementById("roomdiv"+roomno).innerHTML=xmlHttp.responseText; } Code (markup): I know it has something to do with this line xmlHttp.onreadystatechange=stateChanged2; Code (markup): and thought maybe this might work: xmlHttp.onreadystatechange=stateChanged2(roomno); Code (markup): but it doesn't. Any ideas? Anyone make sense of my ramblings?