Revision: 1372
Updated Code
at September 30, 2006 21:47 by raws
Updated Code
// ----------------------------------------
// Wrapper function for constructing a request object.
// Parameters:
// reqType: The HTTP request type, such as GET or POST.
// url: The URL of the server program.
// asynch: Whether to send the request asynchronously or not.
// ----------------------------------------
function httpRequest(reqType,url,asynch) {
// Mozilla-based browsers
if (window.XMLHttpRequest) {
request = new XMLHttpRequest();
} else if (window.ActiveXObject) {
request = new ActiveXObject("Msxml2.XMLHTTP");
if (!request) {
request = new ActiveXObject("Microsoft.XMLHTTP");
}
}
// Request could still be null if neither ActiveXObject
// initialization succeeded
if (request) {
initReq(reqType,url,asynch);
} else {
alert("Your browser does not permit the use of all " +
"of this application's features!");
}
}
// ----------------------------------------
// Initialize a request object that is already constructed
// ----------------------------------------
function initReq(reqType,url,asynch) {
// Specify the function that will handle the HTTP response
request.onreadystatechange = handleResponse;
request.open(reqType,url,bool);
request.send(null);
}
Revision: 1371
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 30, 2006 21:46 by raws
Initial Code
// ----------------------------------------
// Wrapper function for constructing a request object.
// Parameters:
// reqType: The HTTP request type, such as GET or POST.
// url: The URL of the server program.
// asynch: Whether to send the request asynchronously or not.
// ----------------------------------------
function httpRequest(reqType,url,asynch) {
// Mozilla-based browsers
if (window.XMLHttpRequest) {
request = new XMLHttpRequest();
} else if (window.ActiveXObject) {
request = new ActiveXObject("Msxml2.XMLHTTP");
if (!request) {
request = new ActiveXObject("Microsoft.XMLHTTP");
}
}
// Request could still be null if neither ActiveXObject
// initialization succeeded
if (request) {
initReq(reqType,url,asynch);
} else {
alert("Your browser does not permit the use of all " +
"of this application's features!");
}
}
// ----------------------------------------
// Initialize a request object that is already constructed
// ----------------------------------------
function initReq(reqType,url,asynch) {
// Specify the function that will handle the HTTP response
request.onreadystatechange = handleResponse;
request.open(reqType,url,bool);
request.send(null);
}
Initial URL
Initial Description
Initial Title
Ajax Request Object Constructor
Initial Tags
ajax, javascript
Initial Language
JavaScript