Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/12/2006, 10:09
gabe_2007
 
Fecha de Ingreso: noviembre-2006
Mensajes: 11
Antigüedad: 17 años, 6 meses
Puntos: 0
Re: Cargar ajax y php

estoy probando con este codigo pero recibo un error... estoy poniendo algo mal?

function nuevoAjax(){
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}

y

function cargarContenido(){
var contenedor;
contenedor = document.getElementById('contenedor');
ajax=nuevoAjax();
ajax.open("GET", centro(),true);
ajax.onreadystatechange=function() {
if (ajax.readyState==4) {
contenedor.innerHTML = ajax.responseText
}
}
ajax.send(null)
}
window.onload= function(){cargarContenido()}

donde tengo el centro() puse un div llamado "contenedor"...
osea yo lo hice todo en el template, esto es valido?? o tengo que crear otra pagina php con el centro() y vincular "ajax.open("GET", "archivocentro.php",true);" ???

gracias!!