jQuery append Google Adsense to div..
Posted
by SoulieBaby
on Stack Overflow
See other posts from Stack Overflow
or by SoulieBaby
Published on 2009-07-17T12:05:37Z
Indexed on
2010/05/20
2:10 UTC
Read the original article
Hit count: 404
Hi everyone, I'm having issues with google adsense and it loading before my jQuery and killing my codes, so I thought I'd try to append the Google Adsense javascript to the appropriate div using the document ready function, here's the code I'm trying to write:
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$(".googleBanners").html("<script language='javascript' type='text/javascript'>\n" + "google_ad_client = 'pub-8487967187298044';\n" + "google_ad_slot = '1088799521';\n" + "google_ad_width = 250;\n" + "google_ad_height = 250;\n" + "</" + "script>\n" + "<script language='javascript' src='http://pagead2.googlesyndication.com/pagead/show_ads.js' type='text/javascript'>" + "</" + "script>");
});
</script>
But I'm not so good writing javascript/jQuery so if someone could help me implement this that would be fantastic.
The error in FF I'm currently getting is "Error: google_protectAndRun is not defined". I'm not sure what that means, but I'm guessing I've written the jQuery code wrong.. lol
© Stack Overflow or respective owner