Location: PHPKode > scripts > My Ajax > my-ajax/class.MyAjax.php
<?

/**
 *	Easy Ajax Code Writer
 *	Powered By : Abo Noor Aldeen
 *	hide@address.com
 *	http://www.unitedislamicteam.com
 *	http://www.uiteam.net
 *	Version : 1.0 Beta 1
 */

class MyAjax {

	var $SendMethod			=	'POST';
	var $Version			=	'1.0 Beta 1';
	var $LoadingMessage		=	'<img src="ajax-loader.gif" border="0"><br />Loading...';
	var	$BrowesErrorVersion	=	'Could not create connection object.';



	function MyAjax ()	{

		print "
\n\n\n<script language='javascript'>

//Make IE Behave like Mozilla
if (typeof XMLHttpRequest == 'undefined' && window.ActiveXObject) {
	function XMLHttpRequest() {
		var arrSignatures = ['MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'];

		for (var i=0; i < arrSignatures.length; i++) {
			try {
				var oRequest = new ActiveXObject(arrSignatures[i]);
				return oRequest;
			} catch (oError) {
				//ignore
			}
		}
		throw new Error('MSXML is not installed on your system.');
	}
}

var XMLObject	=	XMLHttpRequest()
var XMLError	=	false

if (!XMLObject) {
 	alert ('{$this->BrowesErrorVersion}')
 	XMLError	=	true
}


function UpdateAjaxZone(AjaxZone) {

	if (XMLObject.readyState == 4 && XMLObject.status == 200) {

		var NewHTML = XMLObject.responseText;

		if (NewHTML) {
			AjaxZone.innerHTML = NewHTML;
		}
	}
}

</script>\n";
	}
//Dynamic Drive


	function PrintGetFunction ($FunctionName,$AjaxZoneID) {

		$this->SendMethod	=	'GET';

		return print "
<script language='javascript'>
function $FunctionName(Link,CallLoading) {

	if (XMLError) { return false }

	var AjaxZone	=	document.getElementById('$AjaxZoneID')

	if (CallLoading) {
		AjaxZone.innerHTML = '{$this->LoadingMessage}';
	}

	XMLObject.onreadystatechange = function () { UpdateAjaxZone(AjaxZone) }
	XMLObject.open('{$this->SendMethod}', Link, true)
	XMLObject.send(null)
}
</script>\n";
	}



	function PrintPostFunction ($FunctionName,$AjaxZoneID) {

		$this->SendMethod	=	'POST';

		return print "
<script language='javascript'>
function $FunctionName(Page,Link,CallLoading) {

	if (XMLError) { return false }

	var AjaxZone	=	document.getElementById('$AjaxZoneID')

	if (CallLoading) {
		AjaxZone.innerHTML = '{$this->LoadingMessage}';
	}


	XMLObject.onreadystatechange = function () { UpdateAjaxZone(AjaxZone) }
	XMLObject.open('{$this->SendMethod}', Page, true);
	XMLObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	XMLObject.setRequestHeader('Connection', 'close');
	XMLObject.setRequestHeader('Content-length', Link.length);
	XMLObject.send(Link);
}
</script>\n";
	}

}
Return current item: My Ajax