Answer the question
In order to leave comments, you need to log in
Ajax fires 3 times?
Good afternoon!
There is a script for js and jquery, or rather an ajax request, but it works something like 3 times:
$(document).ready(function(){
$('.my_basket_call').on('click', function(){
var kolp = $(this).attr("data-offer-id");
var buy_id = $(this).attr('id');
var inputId = $(this).data('input');
var newValue = $('#'+inputId).val(); //прибавили +1
console.log(kolp);
console.log(buy_id);
console.log(newValue);
$.ajax({
url: 'request.php',
type: 'POST',
data: ({basket:buy_id, quinity: newValue,torg_p:kolp}),
dataType: 'html',
beforeSend: funcBuy,
success: funcSuccessbuy
});
});
function funcBuy() {
}
function funcSuccessbuy(data) {
$('.show_basket').html(data);
}
});
Answer the question
In order to leave comments, you need to log in
I solved the problem in my own way, suitable for those who work on 1c bitrix:
just where the repetition occurs, add this code after ajax:
jsAjaxUtil.CloseLocalWaitWindow();
Is this code in a component? Maybe the component is connected three times on the page.
check what events are hung on this element, it can be stupid three times the click event is hung on the element
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question