// JavaScript Document /* interface XMLHttpRequest { // event handler attribute EventListener onreadystatechange; // state const unsigned short UNSENT = 0; const unsigned short OPENED = 1; const unsigned short HEADERS_RECEIVED = 2; const unsigned short LOADING = 3; const unsigned short DONE = 4; readonly attribute unsigned short readyState; // request void open(in DOMString method, in DOMString url); void open(in DOMString method, in DOMString url, in boolean async); void open(in DOMString method, in DOMString url, in boolean async, in DOMString user); void open(in DOMString method, in DOMString url, in boolean async, in DOMString user, in DOMString password); void setRequestHeader(in DOMString header, in DOMString value); void send(); void send(in DOMString data); void send(in Document data); void abort(); // response DOMString getAllResponseHeaders(); DOMString getResponseHeader(in DOMString header); readonly attribute DOMString responseText; readonly attribute Document responseXML; readonly attribute unsigned short status; readonly attribute DOMString statusText; }; */ //-------------------------------------------------------------------- function createAjaxObj() { if (window.XMLHttpRequest) { // Non-IE browsers return new XMLHttpRequest(); } if (window.ActiveXObject) { // IE req = new ActiveXObject("Microsoft.XMLHTTP"); return req; } return null; } //-------------------------------------------------------------------- function loadRemoteXml(url, func, id, placehold){ var el = document.getElementById(id); if(!el) return false; if(placehold && placehold.length) el.innerHTML = placehold; var xmlhttp = createAjaxObj(); if(!xmlhttp) return false; xmlhttp.onreadystatechange = function() { if ((xmlhttp.readyState==4) && (xmlhttp.status==200)){ func(xmlhttp, id); } } xmlhttp.open("GET",url,true); xmlhttp.send(null); return true; } //-------------------------------------------------------------------- function writeXmlResponse(req, id) { var el = document.getElementById(id); if(!el) return false; el.innerHTML = req.responseText; return true; } //-------------------------------------------------------------------- function ajaxLoad(ajaxURL, callbackFunction, passBacks, httpVerb, httpPost){ if((typeof(httpPost) == 'undefined') || !httpPost.length()) httpPost = null; if((typeof(httpVerb) == 'undefined') || (!httpVerb.match('^(GET|POST|HEAD)$'))) httpVerb = 'GET'; var xmlHttp = createAjaxObj(); if(!xmlHttp){ callbackFunction(null, 0, passBacks); return false; } xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState==4){ try{ callbackFunction(xmlHttp, xmlHttp.status, passBacks); } catch(e) { return false; } } return true; } xmlHttp.open(httpVerb,ajaxURL,true); xmlHttp.send(httpPost); return xmlHttp; } //--------------------------------------------------------------------