Skip to content

Instantly share code, notes, and snippets.

@ASDAFF
Last active September 5, 2019 19:14
Show Gist options
  • Select an option

  • Save ASDAFF/43e58e2fd55182b1915f3165546e8486 to your computer and use it in GitHub Desktop.

Select an option

Save ASDAFF/43e58e2fd55182b1915f3165546e8486 to your computer and use it in GitHub Desktop.
ajax обновление корзины
//удаление товара из корзины в попапе
$(document).on("click", '.t-basket__close', function(e) {
e.preventDefault();
var id = $(this).attr('itemId');
$.ajax({
url: '/local/ajax/delforbasket.php',
data: {
id: id,
},
dataType: 'json',
success: function(result){
$('.header__h-info li.h-info__item-basket span.h-info__count').text(parseInt($('.header__h-info li.h-info__item-basket span.h-info__count').text())-1);
// начало аджакс запроса обновления корзины
$.ajax({
url:'/local/ajax/addtocart.php',
type:'POST',
data:{'basket':'refresh'},
success: function(data) {
$('#basket_popup').html(data);
},
})
// конец запроса
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment