function ajaxObject() { this.scriptName = null; this.postString = null; this.handlerFunction = null; this.handlerParams = null; this.connection = null; if(gScriptName != undefined) { this.scriptName = gScriptName; } this.contentType = 'application/x-www-form-urlencoded'; this.connection = this.createConnection(); } ajaxObject.prototype = { createConnection: function () { var requestObject; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer") { requestObject = new ActiveXObject("Microsoft.XMLHTTP"); } else { requestObject = new XMLHttpRequest(); } return requestObject; } sendRequest: function() { this.connection.open('POST', this.scriptName, true); this.connection.setRequestHeader('Content-Type', this.contentType); this.connection.onreadystatechange = function() { this.handlerFunction(); }; this.connection.send(this.postString); } } new ajaxObject();