Ver Mensaje Individual
  #29 (permalink)  
Antiguo 14/06/2012, 03:27
Avatar de dontexplain
dontexplain
 
Fecha de Ingreso: junio-2012
Mensajes: 536
Antigüedad: 11 años, 10 meses
Puntos: 127
Respuesta: Variables de sesion

Cita:
Iniciado por Gothgauss Ver Mensaje
El código de php queda así:
Código:
<?session_start();
$_SESSION['producto'][] = $_GET['producto'];
echo json_encode($_SESSION['producto']);

?>
y el script.php

Código:
<?session_start();?>
<head>
<script type="text/javascript" src="../js/jquery.js"></script>

<script>

$(document).ready(function(){
			$('#boton').click(function(){
	
			$.ajax({
				type:'GET',
				url:'sesion.php',
				data:{"producto":$('#texto').val()},
                                success: function(data){

                                        datos = data;

                                         datos = $.parseJSON(data);
														$.each(datos, function(i,j){
																	 $('#mostrardatos').text(value); 
															})
                                         }
											 
				});
				
			});
});





</script>
</head>
<body>

<input type="text" id="texto" /><input type="button" id="boton" value="dar" />

<span id="mostrardatos"></span>
</body>
pero no me da ningún resultado :(
$('#mostrardatos').text(value);

ese value de donde viene, si estás haciendo un bucle, el valor es la segunda variable del argumento, o sea, la j

$('#mostrardatos').html(j);