javascript - Build a list with JSON and jQuery -


i need build list using parameters "name" taken file "sendjson.php" (in json, of course). how can create list using jquery one?

<div id="firstresultname">firstresultname</div> <div id="secondresultname">secondresultname</div> 

i don't know how result possible detect , write right number on div? thanks!

$.each(json, function(key, value){     $("body").append('<div id="'+value+'">'+value+'</div>'); }); 

or just

$.each(json, function(key, value){     $("body").append('<div>'+value+'</div>'); }); 

to retreive json & proccess, following

$.ajax({     'url' : 'yoururl.php',     datatype: 'json',     success: function(json){         $.each(json, function(key, value){             $("body").append('<div>'+value+'</div>');         });     } }); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -