Inserting Javascript files/code within jQuery

Hi,

I am trying to insert a Goodle Adsense code inside a jQuery snippet, but I can’t work out how to include it within my code.

This is my code:

$(document).ready(function(){
        jQuery( "GOOGLE_ADSENSE_HERE" ).insertAfter( ".listing-box:nth-of-type(3)" );
});

I am trying to insert the below where it says GOOGLE_ADSENSE_HERE.

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-xxx"
     data-ad-slot="xxx"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

How would I do this?

Thank you.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.