using jQuery to load the body of another HTML document between entries
- by justin hall
I'm trying to use jQuery to load the body of another HTML document, which contains our AdSense banner. It should display under each blog entry when in list view. I'm able to get it to load text, even images, but not the banner; the banner is a small script.
Here is the website we are working with: http://neverknowtech.com/data/ (that's a test page, and the 'entry' displayed there contains the intended body content)
As you can see here the body code does include an ad, and the word 'Ad'. The word 'Ad' is shown correctly below the post (as it is in list view) but the script for the Google Ad doesn't seem to make it.
Here is what we have in the footer currently (replace [ with < and ] with ):
[script type="text/javascript"]
var classSelector = ":nth-child(1n)";
if ($(".list-journal-entry-wrapper .journal-entry-wrapper").length ] 0) {
$('.list-journal-entry-wrapper .journal-entry-wrapper' + classSelector).after('[div class="journal-list-ad-insert"][/div]');
$('.list-journal-entry-wrapper .journal-list-ad-insert').load("/data/journal-list-ad-insert.html .body");
}
[/script]
note: the nth-child is there for when they decide how frequently to place the ads.