$(document).ready(function(){
$('form').submit(function(){
event.preventDefault();
var order = $(this).serialize();
$.ajax({
url: "action.php",
type: "post",
dataType: "json",
data: order,
success: function(data){
if(data.result == "ok"){
$('.messages').html("<span style='color: green; background: white'>Сообщение успешно отправлено!</span>");
$('#user_name').val('');
$('#user_email').val('');
$('#text_comment').val('');
var template = Handlebars.compile( $('#template').html() );
//пытаюсь передать значения через переменную order, но так не передаёт
$('.updates').append( template(order) );
}else{
$('.messages').html(data.result);
}
}
});
});
});