﻿var xmlHttp;
var xmlHttpResponse;

function SendAjaxData(url, queryString)
{
//    alert("SendAjaxData");
	if (window.ActiveXObject) // code for IE
	{
		xmlHttp=new ActiveXObject("Microsoft.xmlHttp");
		if (xmlHttp)
		{
			xmlHttp.onreadystatechange = populateResponse;
			xmlHttp.open("GET", url + "?r=" + Math.random() + "&" + queryString, false);
			xmlHttp.send();
		}
	}	
	else if (window.XMLHttpRequest)
	{				
		xmlHttp=new XMLHttpRequest();
		xmlHttp.onload = populateResponse;							
		xmlHttp.open("GET", url + "?r=" + Math.random() + "&" + queryString, false);	
		xmlHttp.send(null);
	}
}

function populateResponse()
{
	if (xmlHttp.readyState==4)
	{
		if (xmlHttp.status==200) //data found and is ok
		{
			xmlHttpResponse = xmlHttp.responseText;
		}
		else if(xmlHttp.status==500)
		{
			xmlHttpResponse = "Server Error";
		}
		else if(xmlHttp.status==404)
		{
			xmlHttpResponse = "Page Not Found";
		}
	}
}