Reputation:
I'm trying to insert new li
with img
element inside ul
based on array, so i'm doing this, but just first item in array is being inserted
$.getJSON('/test-url/123').done (data) ->
$.each data, (index, value) ->
$('.col ul').html('<li><img src=' + value['m'] + '><li>')
Upvotes: 0
Views: 27
Reputation: 1498
Try this:
$.getJSON('/test-url/123').done (data) ->
$.each data, (index, value) ->
$('.col ul').append('<li><img src=' + value['m'] + '><li>')
Upvotes: 1