var ajax_ctl=null; var sysbusyInterval=null; /* **** ----------------------------------------- * FUNCTION: getData trg=[string] element_id that is to receive updated content returned from request pgurl=url of page to request cbk=callback function name mthd = request type, must be one of "GET", "POST", "HEAD", or other valid http request type PUT||DELETE params = any url parameters to send, such as (id=12, pg=login) ----------------------------------------- syntax: getData(trg,pgurl,cb,mthd,param) or: use following line to set recurring call, such as a stock ticker that updates once each minute ajax_interval=setInterval('getData(elmId,URL,CB,Method,Params)', 60000); **** ----------------------------------------- */ function getData(trg,pgurl,cb,mthd,param){ ajax_ctl=new atom_xttp(trg,pgurl,cb,mthd,param); ajax_ctl.exec(); } /* **** ----------------------------------------- * OBJECT: ATOM_XTTP ARGUMENTS: elm_id = [string] element_id that is to receive updated content returned from request url = url of page to request clbk = callback function mthd = request type, must be one of "GET", "POST", "HEAD", or other valid http request type PUT||DELETE params = any url parameters to send, params should be in format: var params="id=12&pg=login"; **** ----------------------------------------- */ function atom_xttp(elm_id, RSRURL, clbk, rq_typ, params,stackndx) { var ref = this; this.elm = (elm_id!=null)?set(elm_id):null; this.state = 'ready'; this.RSRURL=RSRURL; this.clbk = clbk;//+'()'; this.xttp = null; this.req=rq_typ this.parameters=params; this.exec = function() { if (ref.state=='ready') { ref.state='executing'; ref.xttp = get_xhttp(); if(!ref.xttp){ alert("This application requires the use of a technology called 'AJAX' which is not supported by your browser"); return false; } ref.xttp.open(this.req, ref.RSRURL, true); ref.xttp.onreadystatechange=function(){ if(ref.xttp.readyState=='4'||ref.xttp.readyState=="complete"){ /* if(sysbusyInterval){ clearInterval(sysbusyInterval); } var stat=ref.xttp.status; window.status='Get Page Request Status:'+stat; ref.state='ready'; if(ref.elm!=null){ var h=""; h+=ref.xttp.responseText; var stat=ref.xttp.status; if(stat=='200'){ //alert(h); ref.elm.innerHTML=h; }else{ ref.elm.innerHTML='