Use JQuery to convert JSON array to HTML bulleted list -


how can convert array of strings represented in json format , convert html bulleted list using jquery?

var ul = $('<ul>').appendto('body'); var json = { items: ['item 1', 'item 2', 'item 3'] }; $(json.items).each(function(index, item) {     ul.append(         $(document.createelement('li')).text(item)     ); }); 

as far fetching json server using ajax concerned use $.getjson() function.

live demo.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -