user1595858
user1595858

Reputation: 3890

unable to parse JSON data using jQuery

I am trying to parse the data from JSON format, but i get first alert which is (insdie 1: object Object) and then i don't get the second alert. I am not sure what i did wrong.

JS

$.getJSON("http://localhost:8080/JsoupPrj/JasonGen?url="+url
                    ,function(data){
                var imageData = [];
                alert("inside 1 :" + data);
                $.each(data.items,function(i, item){
                    alert("insdie 2");
                    alert(item);
                    });

JSON DATA

{
  "title" : "x",
  "Description" : "rrr.",
  "images" : [ "http://1.jpg", "http://2.jpg", "http://3.jpg" ]
}

Upvotes: 0

Views: 106

Answers (1)

nnnnnn
nnnnnn

Reputation: 150070

Your JSON data doesn't have a property called items, so data.items is undefined. Try data.images instead:

$.each(data.images,function(i, item){

Upvotes: 1

Related Questions