$(document).ready(function() { function detect() { $.getScript( "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" ) .done(function( script, textStatus ) { console.log('Google Ads Is Active'); }) .fail(function( jqxhr, settings, exception ) { $('#detail_text').hide(); $('#no_ads').show(); }); } detect(); });