How can I insert a picture into an array? It is desirable that the path was through src or from options only from the buffer? If only from the buffer, how?

Code

`http://codepen.io/rublev/pen/ZOYvNL` $(document).ready(function() { // Product data to be used in shop and in cart var products = { 'Нью-Π™ΠΎΡ€ΠΊ' : ['Нью-Π™ΠΎΡ€ΠΊ', "Π‘Ρ‹Ρ€, ΡˆΠ°ΠΌΠΏΠΈΠ½ΡŒΠΎΠ½Ρ‹,салями, ΠΏΠΎΠΌΠΈΠ΄ΠΎΡ€Ρ‹ 1300Π³Ρ€.", 699, '', 1], 'ВСгитарианская' : ['ВСгитарианская', "Π‘Ρ‹Ρ€, ΡˆΠ°ΠΌΠΏΠΈΠ½ΡŒΠΎΠ½Ρ‹,салями, ΠΏΠΎΠΌΠΈΠ΄ΠΎΡ€Ρ‹ 1300Π³Ρ€.", 699, '', 2], 'Π‘Π΅ΠΌΡƒΡˆΠΊΠ°' : ['Π‘Π΅ΠΌΡƒΡˆΠΊΠ°', "Π‘Ρ‹Ρ€, ΡˆΠ°ΠΌΠΏΠΈΠ½ΡŒΠΎΠ½Ρ‹,салями, ΠΏΠΎΠΌΠΈΠ΄ΠΎΡ€Ρ‹ 1300Π³Ρ€.", 699, '', 3], 'Π–ΡƒΠ»ΡŒΠ΅Ρ‚Π°' : ['Π–ΡƒΠ»ΡŒΠ΅Ρ‚Π°', "Π‘Ρ‹Ρ€, ΡˆΠ°ΠΌΠΏΠΈΠ½ΡŒΠΎΠ½Ρ‹,салями, ΠΏΠΎΠΌΠΈΠ΄ΠΎΡ€Ρ‹, яйцо 1300Π³Ρ€.", 699, '', 4], 'Бтоличная' : ['Бтоличная', "Π‘Ρ‹Ρ€, ΡˆΠ°ΠΌΠΏΠΈΠ½ΡŒΠΎΠ½Ρ‹,салями, ΠΏΠΎΠΌΠΈΠ΄ΠΎΡ€Ρ‹ 1300Π³Ρ€.", 699, '', 5], 'ΠšΠ°Π»ΡŒΡ†ΠΈΠΎΠ½Π΅ ΠΏΠΎ-мСксикански' : ['ΠšΠ°Π»ΡŒΡ†ΠΈΠΎΠ½Π΅', "Π‘Ρ‹Ρ€, ΡˆΠ°ΠΌΠΏΠΈΠ½ΡŒΠΎΠ½Ρ‹,салями, ΠΏΠΎΠΌΠΈΠ΄ΠΎΡ€Ρ‹ 1300Π³Ρ€.", 699, '', 6] }; var drinks = { 'Coca-cola' : ['Coca-cola', "0.33", 69, '', 1], 'Pepsi' : ['Pepsi', "0.33", 69, '..img/pepsi.png' , 2], 'Heineken' : ['Heineken', "0.33", 69, '', 3] }; // Populates shop with items based on template and data in var products var $shop = $('.shop'); var $shopDrinks = $('.shopDrinks'); var $cart = $('.cart-items'); for(var item in products) { var itemName = products[item][0], itemDescription = products[item][1], itemPrice = products[item][2], itemImg = products[item][3], itemId = products[item][4], $template = $($('#productTemplate').html()); $template.find('.main-menu__product-name').text(itemName); $template.find('.pizza-structure').text(itemDescription); $template.find('.main-menu__cash').text(itemPrice + 'Π '); $template.data('id', itemId); $template.data('name', itemName); $template.data('description', itemDescription); $template.data('price', itemPrice); $template.data('image', itemImg); $shop.append($template); } for(var drink in drinks){ var drinkName = drinks[drink][0], drinkSize = drinks[drink][1], drinkPrice = drinks[drink][2], drinkImg = drinks[drink][3], drinkId = drinks[drink][4], $template = $($('#drinkTemplate').html()); $template.find('.drink-name').text(drinkName); $template.find('.drink-price').text(drinkPrice + 'Π '); $template.find('drink-img', 'src(' + drinkImg + ')'); $template.find('.drink-size').text(drinkSize); $template.data('id', drinkId); $template.data('name', drinkName); $template.data('price', drinkPrice); $template.data('img', drinkImg); $template.data('size', drinkSize); $shopDrinks.append($template); } }); 
  • Everything related to the question should be in the question itself. Links can only serve as a supplement. - Dmitriy Simushev
  • Fixed, added code. - spmpl

0