JSFiddle - React, Tailwind, and code Playground
by Trisox
JavaScript
clearTimeout(timer); //clearing timer
timer = setTimeout(function() { //Notice:the number at then end of this function sets the timout time before executing it
$("#showData").html("Loading...");
$.post('http://localhost:9180/eCommerce/shoppingCart/updateBasket', function(data) {
console.log(data);
// console.log(data.post_response,'post_response');
if (data.error) {
// do something with the error it will be data.error
} else {
$.each(data.basket.articles, function(i, el) {
var table = $('.articleTable:eq(' + i + ')');
table.find('.hiddenArticleRowNumber').val(el.lineId).end().find('.articlePrice').html(el.price).end().find('.articleTotalPrice').html(el.totalPrice).end();
});
}
}, 'json');
}, 300);