Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/03/2010, 15:30
Avatar de gachon
gachon
 
Fecha de Ingreso: septiembre-2004
Ubicación: En Google
Mensajes: 462
Antigüedad: 19 años, 8 meses
Puntos: 3
cargar multiples div por favor

Hola muy buenas, me gustaria saber como podria cargar varios div, estoy probando pero se queda el archico loading cargando pero no carga, pero carga el segundo getdata. Cargando un solo div sale estupendamente, pero con dos ya no
este es mi codigo
Código PHP:
// here we define global variable
var ajaxdestination="";
function 
getdata(what,where) { // get data from source (what)
 
try {
   
xmlhttp window.XMLHttpRequest?new XMLHttpRequest():
          new 
ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (
e) { /* do nothing */ }

 
document.getElementById(where).innerHTML ="<div class='preload'><center><img src='imagenesfondo/ajax-loader.gif'></center></div>";
// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
 
ajaxdestination=where;
 
xmlhttp.onreadystatechange triggered// when request finished, call the function to put result to destination DIV
 
xmlhttp.open("GET"what);
 
xmlhttp.send(null);
  return 
false;
}

function 
triggered() { // put data returned by requested URL to selected DIV
  
if (xmlhttp.readyState == 4) if (xmlhttp.status == 200
    
document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText;

y este es el enlace de como intento cargar varios div
Código PHP:
<a href="javascript:void(0);" onclick="getdata('principal.html','contenidoarriba');getdata('principalservicios.html','contenidolateralderecho');" target="_top">Inicio</a
como ven llamo dos veces getdata pero solo carga la pagina principalservicios.html,porque principal.html se queda con mensaje de cargando a ver si por favor pueden ayudarme
saludos y muchas gracias

Última edición por gachon; 21/03/2010 a las 15:38