Ver Mensaje Individual
  #11 (permalink)  
Antiguo 10/10/2012, 12:02
Avatar de maximendez88
maximendez88
 
Fecha de Ingreso: septiembre-2012
Ubicación: Montevideo
Mensajes: 131
Antigüedad: 11 años, 7 meses
Puntos: 3
Respuesta: mostrar un listado php con ajax

Cita:
Iniciado por Dradi7 Ver Mensaje
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. }




se ve muy bien asi... pero sigue sin funcionar el listar...