Tema: input jquery
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/09/2010, 11:06
Avatar de catpaw
catpaw
 
Fecha de Ingreso: mayo-2010
Ubicación: xalapa
Mensajes: 856
Antigüedad: 14 años
Puntos: 23
Respuesta: input jquery

Sale chav@s ya obtengo el valor mi input en mi variable php, aca el codigo:

Código HTML:
<html>
<head>
  <link href="../fecha/js/jquery-ui-1.8.5.custom.css" rel="stylesheet" type="text/css"/>
  <script src="../fecha/js/jquery-1.4.2.min.js"></script>
  <script src="../fecha/js/jquery-ui-1.8.5.custom.min.js"></script>
  <script>
  $(document).ready(function(){
   $("#datepicker").datepicker({
   showOn: 'both',
   buttonImage: 'calendar.png',
   buttonImageOnly: true,
   changeYear: true,
   numberOfMonths: 1,
   onSelect: function(fecha_cumple, objDatepicker){
    //var fecha = $(this).val();
    var fecha = $("#datepicker").attr("value");
    alert(fecha);
		   	$.ajax({    
   		type: "POST",       
   		url: "../fecha/fecha.php",  
   		data: "fecha="+fecha,          
   		success: function(data){      
   			alert( "La fecha que eligio: " + data );     
   		}
   		});
   	}
   });
   })
   </script>
    
</head>

<body>

<form  action="" method="post">
	FECHA: <input type="text" id="datepicker" name="fecha" />
</form>


<?PHP
$fecha=$_POST['fecha'];
echo $fecha;
?>

</body>
</html> 
Nada mas que ahora hace algo raro, les cuento:

- selecciono la fecha
- salta el primer alert con la fecha que seleccione
- despues salta el segunto alert y pone:
La fecha que eligio: <html> ... </html>
es decir m imprime el codigo completo desde que abro html hasta que lo cierro. Y no entiendo por que, la variable data esta guardando todo el codigo???

El caso es que mi variable php $fecha, al imprimir todo el codigo veo q si esta recogiendo bien la fecha...

Solo quisiera saber por que en lugar de imprimir solo la fecha que selecciono, imprime todo mi codigo...Alguna idea o sugerencia???}

GRacias