Skip to content

Instantly share code, notes, and snippets.

@amirkhan81
Created March 5, 2018 23:14
Show Gist options
  • Save amirkhan81/d61b53a656cfa33adc9367b2858e42da to your computer and use it in GitHub Desktop.
Save amirkhan81/d61b53a656cfa33adc9367b2858e42da to your computer and use it in GitHub Desktop.
$.getJSON("mydata.json", function(data) {
var html = '';
$.each(data, function(key, value){
html += '<div class="dcell">';
html += '<img src="images/'+value.product+'.png"/>';
html += '<label for="'+value.product+'">'+value.name+':</label>';
html += '<input type="text" id="'+value.product+'" name="'+value.product+'" value="0" stock="'+value.stock+'" price="'+value.price+'" required>';
html += '</div>';
});
$('#yourContainerId').html(html);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment