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

Cita:
Iniciado por Gothgauss Ver Mensaje
que podría ser problema de la variable es lo priemr que pensé, así que sustituí ese valor por algo estático, pero sigue sin ir.

$.ajax({
* * * * * * * * type:'GET',
* * * * * * * * url:'sesion.php',
* * * * * * * * data:{'producto':'macarrones'},
* * * * * * * * * * * * * * * * success: function(data){
*blablabla
Aquí tienes una plantilla, para evitar pequeños errores que pasen desapercibidos por todos:

Cita:
$.ajax({
url: '/path/to/file',
type: 'GET',
data: {param1: 'value1'},
complete: function(xhr, textStatus) {
//called when complete
},
success: function(data, textStatus, xhr) {
//called when successful
},
error: function(xhr, textStatus, errorThrown) {
//called when there is an error
}
});
Por tanto

Código Javascript:
Ver original
  1. $.ajax({
  2.       url: 'sesion.php',
  3.       type: 'GET',
  4.       data: {"producto": 'productocualquiera'},
  5.       success: function(data, textStatus, xhr) {
  6.         data = $.parseJSON(data);
  7.             alert("primer valor del array: "+data[0]);
  8.       },
  9.       error: function(xhr, textStatus, errorThrown) {
  10.         alert("Ha habido un error con la petición");
  11.       }
  12.     });