function BASE() { if(window.XMLHttpRequest) { try { req = new XMLHttpRequest(); } catch(e) { req = false; } } else if(window.ActiveXObject) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { req = false; } } } if (req) { this.HTTP = req; this.error = ""; } else { this.HTTP = null; this.error = "El Navegador no soporta HTTP_REQUEST."; } this.result; this.commandFile = ""; this.params = ""; this.error = ""; this.onreadystatechangeFunction = null; this.respuesta = ""; } BASE.prototype.send = function(parameter) { if(this.HTTP != null){ this.parameter = parameter == undefined ? this.parameter : parameter; this.parameter = this.commandFile + this.parameter; this.HTTP.open("POST", this.parameter , true); this.HTTP.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=ISO-8859-1;'); this.HTTP.send(); if (this.onreadystatechangeFunction != null && typeof this.onreadystatechangeFunction == "function") { this.HTTP.onreadystatechange = this.onreadystatechangeFunction; } else { this.HTTP.onreadystatechange = function() { if (this.readyState == 4) { if (this.status == 200) { this.respuesta = JSON.parse(this.response); } else { this.error = "Error: "+this.status +"\n"+ this.statusText; return ""; } } else { this.error = "readyState: "+this.readyState; return ""; } } } } } BASE.prototype.sendSync = function(parameter) { if(this.HTTP != null){ this.parameter = parameter == undefined ? this.parameter : parameter; this.parameter = this.commandFile + this.parameter; this.HTTP.open("POST", this.parameter , false); this.HTTP.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=ISO-8859-1;'); this.HTTP.send(); return this.HTTP; } }