Ver Mensaje Individual
  #4 (permalink)  
Antiguo 26/11/2013, 10:33
Avatar de Dalam
Dalam
 
Fecha de Ingreso: septiembre-2010
Mensajes: 409
Antigüedad: 13 años, 8 meses
Puntos: 56
Respuesta: Problema al leer un JSON por Ajax

Código Javascript:
Ver original
  1. $(document).ready(function(){
  2.     $('a').click(function(e){
  3.         $.ajax({
  4.             url     :   'people.json',
  5.             data     :  "nocache=" + Math.random(),
  6.             dataType :  'json',
  7.             timeout  :  6000,
  8.             success  :  function(data){
  9.                             //JSON.stringify(data);
  10.                             $.each(data.people, function(key, value){
  11.                                 $('<li>Name : ' + value.name + '</li>').appendTo('ul');
  12.                                 console.log(key + " : " + value);
  13.                             });
  14.             },
  15.             error    :  function(data,status,error){
  16.                             console.log(status + error);
  17.             }
  18.         });
  19.         e.preventDefault();
  20.     });
  21. });