*/
function sajax_debug(text) {
if (!sajax_debug_mode) return false;
-
+
var e= document.getElementById('sajax_debug');
-
+
if (!e) {
e= document.createElement("p");
e.className= 'sajax_debug';
e.id= 'sajax_debug';
-
+
var b= document.getElementsByTagName("body")[0];
-
+
if (b.firstChild) b.insertBefore(e, b.firstChild);
else b.appendChild(e);
}
-
+
var m= document.createElement("div");
m.appendChild( document.createTextNode( text ) );
-
+
e.appendChild( m );
-
+
return true;
}
/**
-* compatibility wrapper for creating a new XMLHttpRequest object.
+* compatibility wrapper for creating a new XMLHttpRequest object.
*/
function sajax_init_object() {
sajax_debug("sajax_init_object() called..")
A = new XMLHttpRequest();
if (!A)
sajax_debug("Could not create connection object.");
-
+
return A;
}
alert("AJAX not supported");
return false;
}
-
+
try {
x.open(sajax_request_type, uri, true);
} catch (e) {
x.onreadystatechange = function() {
if (x.readyState != 4)
return;
-
+
sajax_debug("received (" + x.status + " " + x.statusText + ") " + x.responseText);
-
+
//if (x.status != 200)
// alert("Error: " + x.status + " " + x.statusText + ": " + x.responseText);
//else
-
+
if ( typeof( target ) == 'function' ) {
target( x );
}
else {
alert("bad target for sajax_do_call: not a function or object: " + target);
}
-
+
return;
}
-
+
sajax_debug(func_name + " uri = " + uri + " / post = " + post_data);
x.send(post_data);
sajax_debug(func_name + " waiting..");
delete x;
-
+
return true;
}