$(window).scrollTop(0); var success = false; $( document ).ready(function() { $( document ).on('click', '.enter', function(e){ $.ajax({ type: 'POST', url : '//disclaimer', async : false, success : function(){ $('#disclaimer').remove(); $('body').css('overflow', 'visible'); success = true; } }); if(success && !window.adBlockRunning){ window.open(document.URL); location.href = "/o/p-1"; } }); });