﻿function ajaxPost(url,data,fun){
	var value=null;
	var xmlHttp = null;
	if(window.XMLHttpRequest)
		xmlHttp=new XMLHttpRequest();
	else if(window.ActiveXObject)
	{
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{}
		try
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e)
		{}
	}
	if(!xmlHttp)
	{
		window.alert("不能创建XMLHttpRequest对象实例！");
		return false;
	}

	xmlHttp.onreadystatechange = function(){
		if(xmlHttp.readyState == 4){
			if (xmlHttp.status ==200)
			{
				
				value = xmlHttp.responseText;
			}
			else
			{
				alert("提交数据出错,错误码： [" + xmlHttp.status  + "]");
				//document.write(xmlHttp.responseText);
			}
			eval(fun);
		}
	}
	xmlHttp.open ("POST", url, true);
	xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=UTF-8;"); 
	xmlHttp.send(data);
}