javascript - Looping throught json -
i'm writing ajax post request. problem don't know how loop throught json. on success got function:
.done(function ( data ) { $('#records').append(data); });
and prints content #records this:
0: {id: 1, user_id: 1, title: "first", created_at: "2015-05-15 06:50:21",…} 1: {id: 2, user_id: 2, title: "second", created_at: "2015-05-15 06:50:38",…} 2: {id: 3, user_id: 3, title: "third", created_at: "2015-05-15 06:50:41",…} 3: {id: 4, user_id: 4, title: "fourth", created_at: "2015-05-15 06:50:45",…}
how loop throught id's , pick it's content (1,2,3,4)? in advance!
.done(function ( data ) { $.each(data, function(item) { $('#records').append(item.id); });
});
Comments
Post a Comment