I have what I think is a strange issue but others may see something I am missing.

I am using AJAX functionality to process a php script on a server and then place the output of the script into a div element. Simple right ?!?!

Here is the code snippet

function doWork13(typeCode,colorBlockName,objectCategory,imgID){
	httpObject = getHTTPObject();
	if (httpObject != null) {
		httpObject.open("GET", "loadpic1.php?typeCode=" + typeCode + "&colorBlockName=" + colorBlockName + "&objectCategory=" + objectCategory, true);
		httpObject.onreadystatechange = setOutput13(imgID);

function setOutput13(imgID){
	alert("imgID =" +imgID);
	var img = imgID
	if(httpObject.readyState == 4){
		document.getElementById(img).innerHTML = httpObject.responseText;

This code shown here works perfectly BUT....
I do not want the alert message to be there. When I remove that line of code the script fails to function. There is no error just nothing happens.

The function is to replace one image with another and the variable in question is simply the ID tag of the particular image being modified.

As I said it works with the alert but does not with out, could it be a timing issue in that the alert gives enough time for the if statement in the setOutput13 function become TRUE

just not sure