Simple Ajax

Posted by & filed under Javascript.

function setupSimpleAjax(){
	//instantiate the object
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	} else {
		// code for IE6, IE5
	 	return new ActiveXObject("Microsoft.XMLHTTP");
function AjaxGet(url){
	// Async function - need to pass 'true' as 3rd param below to fire this
		if (simple_xmlhttp.readyState==4 && simple_xmlhttp.status==200){
			// get response from PHP file here;
			// use async just to allow the process to continue without waiting for the response

	return true;

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>