You don't really need to get xmlHttp every time an AJAX call is made. That can be done outside the function upon page load. I also think you should have done onreadystatechange to a function that handles the response, like this:
...
element = 'mydiv';
xmlHttp.onreadystatechange = handleResponse;
xmlHttp.send(null);
function handleResponse()
{
if(xmlHttp.readyState == 4)
{
var response = xmlHttp.responseText;
document.getElementById(element).innerHTML = response;
}
}
This example will only work if xmlHttp and 'element' are declared globally.