PDA

View Full Version : how to reload DIV <script> content without reloading the HTML page



skolnabber
03-12-2010, 07:06 PM
I'm trying unsuccessfully to reload <script> content in a DIV without reloading the HTML page that contains it. The script is for a commenting module provided at www.instacomment.com

My site is set up such that there is one HTML page into which content is loaded from xml on each click of the site's navigation menu. Each time a navigation item is clicked, the DIVS on the HTML page are repopulated with the relative content for the current state of the site. What I'm trying to do is rewrite the following into the 'commentContainer' DIV each time the state of the site is updated:

<div id='commentContainer'>
<script>instac_button(8623, dynamicTagNameForThisCommentsBox);</script>
</div>

The var dynamicTagNameForThisCommentsBox represents the title of the currently loaded xml. Each time the instac_button function is called with a unique tag name (the second argument), a new instance is created. At least that's the way I think it works...

I have been able to get this working using iFrames, but the problem with using iFrames is that each time a page is loaded through the iFrame, it adds to the browser history. And, since I'm using SWFAddress to manage URL creation for each state of the site, the iFrame creates the undesirable side effect of having to click the back/forward button 2 or 3 times to go back or forward.

I'm happy to share a dev URL with the iFrame implementation if at all helpful.

This problem has vexed me for days. Any help would be greatly appreciated.