Ver Mensaje Individual
  #8 (permalink)  
Antiguo 10/10/2012, 11:31
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 ordenemos tu codigo porque asi no entiendo nada

Código Javascript:
Ver original
  1. function save() {
  2.  
  3.     ajax=objetoAjax();
  4.     ajax.onreadystatechange=function() {
  5.         if (ajax.readyState==4) {
  6.             alert("se introdujo con exito en la base de datos");
  7.             if(ajax.status==200)
  8.             {
  9.                 ajaxlistar=otroObjetoAjax();
  10.                 ajax.open("POST","circuit_actual.php",true);
  11.                 ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  12.             }
  13.         }
  14.     }
  15.    
  16.     var cityvalue=encodeURIComponent(document.getElementById('city').value);
  17.     var arrivalvalue=encodeURIComponent(document.getElementById('datepicker_value').value);
  18.     var departurevalue=encodeURIComponent(document.getElementById('otrodatepicker_value').value);
  19.     var commentvalue=encodeURIComponent(document.getElementById('comment').value);
  20.  
  21.     if(arrivalvalue>departurevalue)
  22.     {
  23.         alert('Day of arrival can not be after a day of departure');
  24.     }
  25.     else if(departurevalue<arrivalvalue)
  26.     {
  27.         alert('Day of departure can not be until the arrival day');
  28.     }
  29.     else{
  30.  
  31.         ajax.open("GET", "addCity.php?city="+cityvalue+"&arrival="+arrivalvalue+"&departure="+departurevalue+"&comment="+commentvalue,true);
  32.         ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  33.         //enviando los valores
  34.         ajax.send();
  35.    
  36.         document.getElementById('savecity').disabled = true;
  37.         document.getElementById('more').disabled = true;
  38.         document.getElementById('ciudad').value = "Select other city";
  39.         document.getElementById('add').disabled = false;
  40.         document.getElementById('inner').style.display="block";
  41.         document.getElementById('datepicker_value').value='';
  42.         document.getElementById('otrodatepicker_value').value='';
  43.         document.getElementById('comment').value='';
  44.     }
  45. }
__________________
La clave de todo triunfador es eliminar todas sus excusas y sus limitaciones