2
/*--------------------------------------------------------------------------------
4
----------------------------------------------------------------------------------*/
6
var AJAXQueue = new Array;
7
var AJAXServiceRunning=false;
11
/*--------------------------------------------------------------------------------
14
This is the only interface to the AJAX wrapper. This makes the ajax service
15
browser agnostic and provides a single interface for all of the services.
17
Each service uses a different url and a different parameter layout.
19
----------------------------------------------------------------------------------*/
21
function AjaxService(servicename,serviceparam){
23
AJAXQueue.push(servicename);
24
AJAXQueue.push(serviceparam);
26
if(!AJAXServiceRunning){
27
AJAXServiceRunning=true;
28
var Aparam=AJAXQueue.pop();
29
var Aservice=AJAXQueue.pop();
30
AjaxServiceExec(Aservice,Aparam);
34
/*--------------------------------------------------------------------------------
37
This is the only interface to the AJAX wrapper. This makes the ajax service
38
browser agnostic and provides a single interface for all of the services.
40
Each service uses a different url and a different parameter layout.
42
----------------------------------------------------------------------------------*/
44
function AjaxServiceExec(servicename,serviceparam){
46
// Parameters are set, initiate AJAX engine
47
if (window.XMLHttpRequest) {
48
httpAjax = new XMLHttpRequest();
49
if (httpAjax.overrideMimeType) {
50
httpAjax.overrideMimeType('text/xml');
52
}else if(window.ActiveXObject){
54
httpAjax = new ActiveXObject("Msxml2.XMLHTTP");
57
httpAjax = new ActiveXObject("Microsoft.XMLHTTP");
59
alert("Couldn�t build an AJAX instance.");
65
// Send request to Server and initiate callback.
68
httpAjax.onreadystatechange = getPage;
70
// alert("onreadystatechange didn�t go well!");
73
httpAjax.open('POST', servicename, true);
74
httpAjax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
76
// alert("Couldn�t open url.");
79
httpAjax.send(serviceparam);
81
// alert("Couldn�t send request.");
89
/*--------------------------------------------------------------------------------
92
This is the AJAX callback function. It detects the invoking service and handles
93
the reply from each service accordingly.
95
----------------------------------------------------------------------------------*/
99
if(httpAjax.readyState == 4){
101
str=httpAjax.responseText;
103
if(AJAXQueue.length>0){
104
var Aparam=AJAXQueue.pop();
105
var Aservice=AJAXQueue.pop();
106
AjaxServiceExec(Aservice,Aparam);
108
AJAXServiceRunning=false;
113
// If any other ready state than prepared, do nothing!