Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/01/2009, 14:51
samy4ever
 
Fecha de Ingreso: agosto-2008
Mensajes: 143
Antigüedad: 15 años, 9 meses
Puntos: 1
Respuesta: Corrección Javascript en AJAX

Hola!

He probado lo que comentas pero no me funciona. Cuando miro la consola de errores de firefox me da el siguiente error:

myAjax is not defined.

He probado en dejarlo en "ajax" pero no funciona. Alguna idea? Tiene que ser algo conceptual, pero no veo el qué. Gracias por vuestro tiempo!

Código:
function getdata(what, where, page) { // get data from source (what)
try {
	xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
	new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) { alert("Error loading data. Try another browser, please. Thank you for your patience.");}
	checks(page);
	document.getElementById(where).innerHTML ="<center id=ajax>Cargando...<br><img src='ajax-loader.gif'></center>"; // Gif while loading data
	ajaxdestination=where;
	xmlhttp.onreadystatechange = lanzamos_funcion; // when request finished, call the function to put result to destination DIV
	xmlhttp.open("GET", what);
	xmlhttp.send(null);
	var scs=myAjax.responseText.extractScript();    //capturamos los scripts 
        myDivUoTroLugar.innerHTML=myAjax.responseText.stripScript();
        scs.evalScript();       //ahora si, comenzamos a interpretar todo  
	return false;
}
Y en el header del index.php tengo:

Código:
<script type="text/javascript" src="./funcions.js"></script>
<script type="text/javascript" src="./slide.js"></script>
<script type="text/javascript" src="./interpretadorAjax.js"></script>

Última edición por samy4ever; 17/01/2009 a las 14:53 Razón: Edito para que el código quede algo mejor