//Muchoooo cuidado al utilizar numProcAjax=3 ya que actua de otra forma var READY_STATE_UNINITIALIZED = 0; var READY_STATE_LOADING = 1; var READY_STATE_LOADED = 2; var READY_STATE_INTERACTIVE = 3; var READY_STATE_COMPLETE = 4; var peticion_http = null; function inicializa_xhr() { if(window.XMLHttpRequest) {return new XMLHttpRequest();} else if(window.ActiveXObject) {return new ActiveXObject("Microsoft.XMLHTTP");} } function proceso_ajax(url,asincrono) { peticion_http = inicializa_xhr(); if (peticion_http) {peticion_http.onreadystatechange = procesaRespuesta; peticion_http.open('GET', url+'&nocache=' + Math.random(), asincrono); peticion_http.send(null); } } function procesaRespuesta() { if(peticion_http.readyState == READY_STATE_COMPLETE) { if(peticion_http.status == 200) { if (!peticion_http.responseXML) { //var parser=new DOMParser(); //var xmlDoc = parser.parseFromString(peticion_http.responseText, "application/xml"); //vuelta_ajax(xmlDoc); respuestaIncorrecta(peticion_http.responseText); } else { var xmlDoc=peticion_http.responseXML.documentElement; if (numProcAjax==3) {xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; xmlDoc.loadXML(peticion_http.responseText); vuelta_ajax(xmlDoc); return;} if (xmlDoc == null) {respuestaIncorrecta(peticion_http.responseText);} else {vuelta_ajax(xmlDoc)}; } } } } function respuestaIncorrecta(txt) { //alert(txt);return; valores='menubar=no,titlebar=no,toolbar=no,status=no,scrollbars=yes,width=500,height=500,left=300,top=150' WRI=window.open('/feran/?MIval=/RespuestaIncorrectaAjax.html&txt='+escape(txt),'WRI',valores); WRI.focus(); } function ltrim(s) { return s.replace(/^\s+/, ""); } function rtrim(s) { return s.replace(/\s+$/, ""); } function trim(s) { return rtrim(ltrim(s)); }