using jQuery to load the body of another HTML document between entries

Posted by justin hall on Stack Overflow See other posts from Stack Overflow or by justin hall
Published on 2010-05-09T21:46:07Z Indexed on 2010/05/09 21:48 UTC
Read the original article Hit count: 359

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.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery