PDA

View Full Version : Ajax Tabs Content script - unable to load external .js files for one of the tabs



illibaro
06-29-2007, 03:41 PM
1) Script Title:
Ajax Tabs Content script

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/

3) Describe problem:
First I want to congratulate the dynamic drive for providing this excellent script. As I am trying to use it however, I am not able to load external js file for one of the tabs.

Here is what i am doing:

a. I created a demo page as per this url
http://www.globalbizsoft.com/temp/poc/day/demo1.htm
It works for all tabs except for the last tab ( sea otter) , where in I am trying to load an external javascript file.

b. I have followed dyanmicdrive guidelines for providing this information for the last tab as per following:
<li><a href="day.html" rel="ajaxcontentarea" rev="day.js">Sea Otter</a></li>

c. The file day.html works on its own (independently) and loads the js file as can be seen here:
http://www.globalbizsoft.com/temp/poc/day/day.html
But it does not work when called from the tab for sea otter.

Would appreciate guidance to resolve this..

Thanks - illibaro :confused:

ddadmin
06-29-2007, 09:13 PM
The problem actually isn't that the feature isn't working, but that you've simply run into a limitation of Ajax. Basically on day.html, the JavaScript you've embedded dynamically writes out content using document.write(). This process can only be performed by the browser inline, when the page is loading. Using Ajax to fetch such a page will result in nothing being written out by document.write(), as this function is now being called dynamically, not inline.

The easiest way to solve problems is to modify your day.html page so it consist of just an <iframe> that then points to the actual page you wish to load (ie: actualday.html). This should work, or you can try Tab Document Viewer (http://dynamicdrive.com/dynamicindex3/tabdocviewer.htm) as well.

illibaro
06-29-2007, 10:03 PM
Thank you! ddadmin. It looks like that tab document viewer makes sense. I would evaluate it.. illibaro