Skip to content Skip to sidebar Skip to footer

Parsing In Jquery

I am trying to parse what I am getting JQuery to show data ! I am consuming data from an API , but I am getting an error . Can I do a Loop on JQuery this way ? $.each(data.results

Solution 1:

As @adeneo commented on the question, the concept is right but you should be careful about what element you are appending HTML content to.

With this snippet of your code:

$htmlstring.append("<div class='title'> Info : "
    Name + Date + Creator "</div>");

(BTW, it is missing two plus signs for a correct concatenation, I hope that's not the error you are getting).

you append a DIV to the UL and you actually want to append it to the LI, for example:

$('<li />').append("<p>Test</p>")
    .append("<div class='title'> Info : " + Name + Date + Creator + "</div>")
    .appendTo($htmlstring);

Check this fiddle for a working solution of your issue: http://jsfiddle.net/d3dcj/2/

Post a Comment for "Parsing In Jquery"