Ver Mensaje Individual
  #10 (permalink)  
Antiguo 10/10/2012, 11:50
Avatar de Dradi7
Dradi7
 
Fecha de Ingreso: junio-2008
Ubicación: Peru - Lima
Mensajes: 1.518
Antigüedad: 15 años, 10 meses
Puntos: 220
Respuesta: mostrar un listado php con ajax

Primero porque haces esto

ajax=objetoAjax();
ajaxlistar=otroObjetoAjax();

Si ya tienes una funcion que te cree el ajax solamente te bastaria llamar a esa funcion
Siempre al declarar una variable por favor usar var

Mira como deberia ser

Código Javascript:
Ver original
  1. function objetoAjax(){
  2.     var xmlhttp=false;
  3.     try {
  4.         xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  5.     } catch (e) {
  6.         try {
  7.             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  8.         } catch (E) {
  9.             xmlhttp = false;
  10.         }
  11.     }
  12.     if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  13.         xmlhttp = new XMLHttpRequest();
  14.     }
  15.     return xmlhttp;
  16. }
  17.  
  18. function save() {
  19.     var ajax = objetoAjax();
  20.     ajax.onreadystatechange=function() {
  21.         if (ajax.readyState==4 && ajax.status==200) {
  22.             listar();
  23.         }
  24.     }
  25.     ajax.open("GET", "addCity.php?city="+cityvalue+"&arrival="+arrivalvalue+"&departure="+departurevalue+"&comment="+commentvalue,true);
  26.     ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  27.     ajax.send();
  28. }
  29.  
  30. function listar(){
  31.     var ajax2 = objetoAjax();
  32.     ajax.onreadystatechange=function() {
  33.         if (ajax2.readyState==4 && ajax2.status==200) {
  34.            
  35.         }
  36.     }
  37.    
  38.     ajax2.open("POST","circuit_actual.php",true);
  39.     ajax2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  40.     ajax2.send("id=4&other=4");//aqui puedes poner tus parametros
  41. }
__________________
La clave de todo triunfador es eliminar todas sus excusas y sus limitaciones