Using livequery to load external javascript into a div layer

Using livequery to load external javascript into a div layer

Forgive me, I'm not a UI developer at all.

I have a messy site with lots of JS/jquery, that loads the primary content for the home page from "index-ok.html" using load():

  1. $('#main').load('index-ok.html);

Inside index-ok.html is a div element with an id of "ad", ie:

  1. <div id="ad"></div>
I need to display some javascript inside of the 'ad' div, that will display some google adsense ads - just inserting the google adsense js code inside of index-ok.html absolutely does not work, so I'm trying to load it from an external file "ad.html" and replace the contents of the 'ad' div.

Here's "ad.html" :

  1.   <div id="content_holder_nopad" style="back-ground-color:ECEEF200;">
  2. <center>
  3. <script type="text/javascript"><!--
  4. google_ad_client = "ca-pub-XXXXXXXXXXXXXXXX";
  5. google_ad_slot = "XXXXXXXX";
  6. google_ad_width = 728;
  7. google_ad_height = 15;
  8. google_ad_background_color = "ECEEF200";
  9. //-->
  10. </script>
  11. <script type="text/javascript"
  12. src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
  13. </script>
  14. </center>
  15.   </div>

and after massive searching and reading it seems that the livequery() method is the proper way to go about this (??). So here's my final attempt:

  1.         $('#main').load('index-ok.html', function() {
  2.                 $('#ad').livequery("load",function() {
  3.                         $(this).load('ad.html', function() {
  4.                                 return false;
  5.                         });
  6.                 });
  7.         });
My index-ok.html is getting loaded fine, but I still have no luck with getting anything at all inside of my 'ad' div....

Any help??