iT邦幫忙

0

PHP-資料庫串接handlebars顯示到HTML筆記(2)

action.js

$(document).ready(function(){
  var commodity_template = $('#commodity-item-template').html();
  var commodity_template_compile = Handlebars.compile(commodity_template);
  var commodity_UI = '';
  
  $.each(commodities, function (index, commodity) { 
    commodity_UI = commodity_UI + commodity_template_compile(commodity);
  });
  
  console.log(commodity_UI);
  
  $(commodity.el).find('.container ul.row').append(commodity_UI);
  
});

尚未有邦友留言

立即登入留言