;(function($, jQuery) { let clickLock = false if(!clickLock) { $('.warranty-search').on('click', '.warranty-link', function(e) { e.preventDefault() clickLock = true jQuery.ajax({ async: true, url: '/service/ajax/ajax_get_warranty_info.php', type: 'POST', dataType: 'html', data: { warranty_no: $(this).text(), type: Math.ceil(Math.random() * 3) }, }).done(function(res) { $('body').addClass('overflow-hidden').append(res) // console.log(res) clickLock = false }).fail(function(x, y, z) { console.log(x) clickLock = false }) }) } $('body').on('click', '.warranty-popup .closer', function(e) { $(this).parents('.warranty-popup').remove() $('body').removeClass('overflow-hidden') }) })($, jQuery)