Kolejny test bez img

function getProducts() {
var dfd = $.Deferred();

$.ajax({
url: ‘http://delectable.site40.net/blog/?json=get_recent_posts&custom_fields=store-icon’,
type: ‘GET’,
dataType: ‘json’,
success: function(data){
var source = $(“#product-template”).html();
var template = Handlebars.compile(source);
var blogData = template(data);
$(‘#product-data’).html(blogData);
$(‘#product-data’).trigger(‘create’);
dfd.resolve(data);

},
error: function(data){
console.log(data);
}
});
return dfd.promise();
};

getProducts().then(function(data){
$(‘#all-posts’).on(‘click’,’li’, function(e){
localStorage.setItem(‘postData’, JSON.stringify(data.posts[$(this).index()]));
});
});

Тэгі:

Глядзі таксама