I have a JSON string below :
{ "name":"Ruby on Rails Baseball Jersey", "price":"19.99",
"id":"1025786064",
"image":"http://127.0.0.1:3001/assets/products/4/product/ror_baseball.jpeg" }, { "name":"Ruby on Rails Baseball Jersey", "price":"19.99",
"id":"1025786064",
"image":"http://127.0.0.1:3001/assets/products/5/product/ror_baseball_back.jpeg" }, { "name":"Ruby on Rails Ringer T-Shirt", "price":"19.99",
"id":"187438981",
"image":"http://127.0.0.1:3001/assets/products/9/product/ror_ringer.jpeg" }, { "name":"Ruby on Rails Ringer T-Shirt", "price":"19.99",
"id":"187438981",
"image":"http://127.0.0.1:3001/assets/products/10/product/ror_ringer_back.jpeg" }, { "name":"Apache Baseball Jersey", "price":"19.99",
"id":"706676762",
"image":"http://127.0.0.1:3001/assets/products/1004/product/apache_baseball.png" }, { "name":"Ruby Baseball Jersey", "price":"19.99", "id":"569012001", "image":"http://127.0.0.1:3001/assets/products/1008/product/ruby_baseball.png" }
Then in jQuery:
var d = eval("(" + data + ")"); //data is the json string above.
$.each(d, function(idx, item) {
alert(item);
});
It's no error,but only show the first one sequence's data,how can i loop thought all the data. thanks you.