Library for XMLHttpRequest Object
Available as http.js
Current version : v1.0 (2006/02/21)
Works(Tested) on Firefox 1.5, IE 6.0
Usage:
var obj = new http(userhandler, pinghandler);
obj.newrequest(method, url, async flag, headers, content to be sent);
obj.ping(url);
obj.poll(method, url, async flag, headers, content to be sent, interval);
obj.stop_poll();
obj.abort() : abort operation
obj.getResponseHeader(name) : as function name
obj.getAllResponseHeader() : as function name
obj.rxml : responseXML
obj.rtxt : responseText
parameters :
method : one of "GET", "POST", "HEAD", "TRACE", etc.
url : url of the file you want to retrieve.
async flag : asynchronously handle the response?
headers : array contains ["HEADER-NAME"] = "VALUE";
content to be sent : additional content to send to the server.
userhandler and pinghandler are user-defined apis whose interfaces defined as follow:
function userhandler(xml) {
/* user-defined operation here */
}
function userhandler(Date) {
/* user-defined operation here */
}
Reference
Example
Content of index.xml :