Foros del Web » Programando para Internet » Javascript »

Problema con XMLHttpRequest

Estas en el tema de Problema con XMLHttpRequest en el foro de Javascript en Foros del Web. Hola, me sale el siguiente aviso: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For ...
  #1 (permalink)  
Antiguo 15/06/2015, 02:41
Avatar de AngelMarine  
Fecha de Ingreso: enero-2014
Ubicación: Madrid
Mensajes: 79
Antigüedad: 10 años, 3 meses
Puntos: 0
Pregunta Problema con XMLHttpRequest

Hola, me sale el siguiente aviso:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

Los scripts son:

ConstructorXMLHttpRequest.js
function ConstructorXMLHttpRequest() {
if(window.XMLHttpRequest) {
return new XMLHttpRequest();
}
else if(window.ActiveXObject) {
var versionesObj = new Array(
'Msxml2.XMLHTTP.5.0',
'Msxml2.XMLHTTP.4.0',
'Msxml2.XMLHTTP.3.0',
'Msxml2.XMLHTTP',
'Microsoft.XMLHTTP'
);
for (var i = 0; i < versionesObj.length; i++) {
try {
return new ActiveXObject(versionesObj[i]);
}
catch (errorControlado) {}
}
}
throw new Error("No se pudo crear el objeto XMLHttpRequest");
}


index.php (solo el script)
....etc
<script language="JavaScript" type="text/javascript">
var peticion01 = null;
peticion01 = new ConstructorXMLHttpRequest();
function Coger(url)
{
if(peticion01)
{
peticion01.open(\'GET\', url, false);
peticion01.send(null);
document.getElementById(\'resultado\').innerHTML = peticion01.responseText;
}
}
</script>
...etc

Antes funcionaba, ahora me sale dicho error, ¿Qué sucede?
  #2 (permalink)  
Antiguo 15/06/2015, 09:28
Avatar de Alexis88
Philosopher
 
Fecha de Ingreso: noviembre-2011
Ubicación: Tacna, Perú
Mensajes: 5.552
Antigüedad: 12 años, 5 meses
Puntos: 977
Respuesta: Problema con XMLHttpRequest

Si dices que antes funcionaba y ahora no, quiere decir que has realizado algún cambio. Déjalo como estaba hasta antes de que empiece a fallar y prueba.

Solo por curiosidad, ¿por qué escapas las comillas? ¿De casualidad estás imprimiendo todo ese código (el código JavaScript del archivo PHP) con un echo?

Saludos
__________________
«Juro por mi vida y mi amor por ella, que jamás viviré para el provecho de otro hombre, ni le pediré a otro hombre que viva para el mío».

Ayn Rand
  #3 (permalink)  
Antiguo 15/06/2015, 11:04
Colaborador
 
Fecha de Ingreso: septiembre-2013
Ubicación: España
Mensajes: 3.648
Antigüedad: 10 años, 7 meses
Puntos: 578
Respuesta: Problema con XMLHttpRequest

¿Por qué usas AJAX sincrónico?

Etiquetas: javascript+html, javascript+php, javascript-funciones, javascript-function
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:36.