Favorite

Favorites are empty

var myOffcanvas = document.getElementById('offcanvasScrolling') myOffcanvas.addEventListener('show.bs.offcanvas', function () { var block = $('#fav_head') $.ajax({ url: "/en/cart/items/", type: 'POST', success: function(res){ $.each( res['data'], function( key, value ) { var cloneB = block.clone() cloneB.find('.fav_url').html(''+value["title"]+'') cloneB.find('.fav_city').html(value['city']) cloneB.find('.fav_img').attr('src', value['img']) cloneB.find('.fav_price').html(value['price']) cloneB.find('.fav_type').html(value['type']) cloneB.show() cloneB.appendTo('#body_fav_h') }); }, error: function(){ alert('Error!'); } }); }) myOffcanvas.addEventListener('hide.bs.offcanvas', function () { $('#body_fav_h').html('') }) $("[data-labelfor]").click(function(e) { var button = $(this) var form = $(this).find('form') var id = form.find("input[name='id']").val() var block = $(this).parent() e.preventDefault() $('#' + $(this).attr("data-labelfor")).prop('checked',function(i, oldVal) { $.ajax({ url: "/en/cart/submit/", type: 'POST', data: {action:!oldVal, id:id}, success: function(res){ console.log(res['res']) if (res['res'] == 'add'){ console.log(block) block.addClass('active') }else{ block.removeClass('active') } }, error: function(){ alert('Error!'); } }); if (button.parent().hasClass("active")) { button.parent().removeClass("active"); return; } // Button On (with a loader) button.parent().addClass("is-loading"); setTimeout(function () { button.parent().removeClass("is-loading").addClass("active"); }, 500); }); }); window.addEventListener("load", function(){ window.cookieconsent.initialise({ "palette": { "popup": { "background": "#ffffff" }, "button": { "background": "#29abe2", "text": "#ffffff" } }, "position": "bottom-right", "content": { "message": "By continuing browsing we understand that you accept our cookies policy.", "dismiss": "I agree", "link": "Read more", "href": "/en/info/cookies/" } })}); });