Ajax = {} Ajax.AjaxRequest = function(sUrl, sType, sParameters) { this.url = sUrl; this.type = sType; this.parameters = sParameters; this._returnedText = ""; if (!window.ajaxRequestsList) { window.callPileIndex = new Array(); window.callPileParam = new Array(); window.ajaxRequestCounter = 0; window.ajaxRequestsList = new Array(); window.xmlhttpArr = new Array(); window.xmlCallbackArr = new Array(); } this.counter = window.ajaxRequestCounter; this._returned = false; window.ajaxRequestsList[this.counter] = this; window.ajaxRequestCounter++; } Ajax.AjaxRequest.prototype.getReturnedText = function() { return this._returnedText; } Ajax.AjaxRequest.prototype.getReturned = function() { return this._returned; } Ajax.AjaxRequest.prototype.execute = function(callback){ var request = $.ajax({ data: $.param(this.parameters, true), type: this.type, url: this.url, context: this, timeout: 20000, dataType: "html", async: true, beforeSend :showWaiting, success: getCallBackjQuery(callback), statusCode: { 404: Error404 } }); } function getCallBackjQuery(callback) { return function(response) { hideWaiting(); this._returnedText = response; this._returned = true; callback(response); } } function Error404(response) { hideWaiting(); alert('page not found '+this.url); } Ajax.AjaxRequestDefault = function(sParameters) { this.ajaxRequest = new Ajax.AjaxRequest('/alert.fl', "GET", sParameters); } Ajax.AjaxRequestDefault.prototype.execute = function(callback){ this.ajaxRequest.execute(callback); } Ajax.AjaxRequestDefault.prototype.getReturnedText = function() { return this.ajaxRequest._returnedText; } Ajax.AjaxRequestDefault.prototype.getReturned = function() { return this.ajaxRequest._returned; }