Cheeki 0 Newbie Poster

Hey guys, im having the weirdest problem with my ajax!! below is the function that is called when ever a if statement evaluates to true. Anyway the problem im having is that this if statement

if(xmlHttp.readyState == 4)

with in the ajax functions runs when readyState is equal to 1 and when equal to 4!! so obviously its printing out twice when its only meant to print out once!!

function getFlowButtons(popUp, flow_button_id)
{
	var xmlHttp = getXMLHttp();
		
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState == 4)
		{
			HandleResponseNewButtonContainer(xmlHttp.responseText);
		}
	}
	
	xmlHttp.open("GET", '../ajax/ajax.php?action=setFlowButtons&value='+flow_button_id+'&value2='+numberofcontainers, true);
	xmlHttp.send(null);
}

CAN ANYONE HELP ME PLEASE!!!