javascript - Ajax JSON application -
i'm able append first image in <li>
. tried use prepend rather append, , shows last image only.
can me please?
$.ajax({ url:'http://localhost/php/events.php', headers:{"content-type": "application/json"}, type:'post', data:$(this), datatype:'json', error:function(jqxhr,text_status,strerror){ alert(strerror); }, timeout:60000, success:function(data){ for(var in data){ $("#images").append("<li>"+data[i]+"</li>"); } } });
into success callback function
, this:
success:function(data){ $.each(data, function(k, v) { $("#images").append("<li>"+ v +"</li>"); }) }
Comments
Post a Comment