0

I am loading a page which contains Google ads in to another page using jQuery's load function.

But Google ads don't appear even though they do when I open the page itself.

What should I do?

EDIT:

Some code:

function load php page:

function get_fb(g) {

$("#hhs").load("hhs.php?rid="+g);

}

and that hhs.php contains the google ads code...

Utku Dalmaz
  • 9,780
  • 28
  • 90
  • 130

1 Answers1

1

Ads are usually embedded via script tags and $(...).load() removes any script tags:

// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append(res.responseText.replace(rscript, ""))

rscript is a Regex matching script tags: /<script(.|\s)*?\/script>/gi

However, AdSense for Ajax might be what you need.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
  • yeah but i dont think google will accept my application with 20.000 monthly view. – Utku Dalmaz Nov 11 '10 at 22:11
  • You are out of luck in that case.. the best solution would be putting the ads on the static part of the main page which is not reloaded dynamically. – ThiefMaster Nov 11 '10 at 22:14
  • It's not just jQuery, inserting ` – bobince Nov 11 '10 at 23:21