Answer the question
In order to leave comments, you need to log in
How to add html using templating engine?
I am using the underscore template engine.
$(document).on("click", ".load-more a", function(){
var id = $('.products').children('li:last').data('id');
inputs = $(".filter form").serializeArray();
var template = $("#products").html();
$.ajax({
type: "post",
url: "/loadmore",
data: { "id":id, "inputs":inputs },
beforeSend: function() {
$(".loader").css('display', 'block');
},
success: function(result) {
setTimeout(function(){
$(".loader").css('display', 'none');
}, 500);
$(".products").append(_.template(template,{ result:result, manufacturers:manufacturers, country:country }));
},
});
});
Answer the question
In order to leave comments, you need to log in
Use this micro-templater and the jQuery append function to load content:
ejohn.org/blog/javascript-micro-templating
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question