﻿//AJAX GET方式
function DoCallbackGet(url, params, Ansyc)
{
	url = url + "?" + params;
	// Initialize the XmlHttp object
	try 
	{
		//Mozilla Browsers
		xmlRequest = new XMLHttpRequest();
	} 
	catch (e) 
	{
		try 
		{
			//IE
			xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (e) 
		{
			//Something else that won't work with this code...
			xmlRequest=false;
		}
	} 
	//背後執行網頁來取得XML物件資料
	xmlRequest.open("GET", url, Ansyc);
	xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlRequest.send(null);
	// Return the XmlHttp object
	return xmlRequest;
}
//AJAX POST方式 url為程式url不需加? params為參數以&隔開的字串
function DoCallbackPost(url, params, Ansyc)
{
	// Initialize the XmlHttp object
	try 
	{
		//Mozilla Browsers
		xmlRequest = new XMLHttpRequest();
	} 
	catch (e) 
	{
		try 
		{
			//IE
			xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (e) 
		{
			//Something else that won't work with this code...
			xmlRequest=false;
		}
	} 
	//背後執行網頁來取得XML物件資料
	xmlRequest.open("POST", url, Ansyc);
	xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlRequest.send(params);
	// Return the XmlHttp object
	return xmlRequest;
}