// Returns a new XMLHttpRequest for IE and others function createXMLHttpRequest() { if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { return new XMLHttpRequest(); } } // Insert content from a url to a div AJAX style using a GET function doAJAXGet(divId, url) { if(document.getElementById(divId)) { // Until the div's content loads, assign a 'loading' image. document.getElementById(divId).innerHTML = " "; var xmlHttp = createXMLHttpRequest(); xmlHttp.onreadystatechange = function() { if(xmlHttp.readyState == 4) { if(xmlHttp.status == 200) { document.getElementById(divId).innerHTML = xmlHttp.responseText; } } }; xmlHttp.open("GET", url, true); xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlHttp.send(null); } }// Insert content from a url to a div AJAX style using a POST function doAJAXPost(divId, url, args) { if(document.getElementById(divId)) { // Until the grid loads, assign a 'loading' image. document.getElementById(divId).innerHTML = " "; var grid_xmlHttp = createXMLHttpRequest(); grid_xmlHttp.onreadystatechange = function() { if(grid_xmlHttp.readyState == 4) { if(grid_xmlHttp.status == 200) { document.getElementById(divId).innerHTML = xmlHttp.responseText; } } }; grid_xmlHttp.open("POST", url, true); grid_xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); grid_xmlHttp.send(args); } }How to do AHAH without a freakin framework |