PDA

View Full Version : Trouble getting an external js file to run



dbonsall
07-04-2006, 04:47 AM
Dynamic Ajax Content
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

Hello,
Let me preface my message by stating that I am really not very good at javascript.

I am having difficulty with getting the Dynamic Ajax Content script to properly run an external .js file in the loadobjs function. I can tell that the external script is being loaded into the browser through the loadobjs function, as it is listed in my activity window. But, it does not execute when run in such a manner.

Here is a link to the page that runs without the ajax script:

http://www.thecuriocloset.com/temp/products.tmpl?category=1027&head=T (the head=T statement includes the html head, and javascript file - this is not used when run in conjunction with the ajax script).

Here is a link to the page that is running with the ajax script:

http://www.thecuriocloset.com/temp/productlist.tmpl

When the external script activates, as it does in the first link, the table's headers turn into links. This does not happen for the second link.

Can these two scripts interfere with each other? Since they are technically running on two different pages, I would not think so, but cannot think of any other explaination.

Thanks for any assistance that can be offered.

Dennis

dbonsall
07-04-2006, 06:33 PM
I think that I may have found what is causing the problem, but I cannot figure out how to solve it. From what I have been able to find out from extensive Google searches, it appears that the javascript file I am intending to include in the external file (sorttable.js) initializes on window.load. The suggestion to fix the problem is to call the function sortables_init after the ajax call. I have tried running the call within the external file, but it appears that the external file will not run any javascript, when that javascript is encoded directly on the external page. Is there some way to call that function from the parent page, and have it execute on the external page? Or is there something else I am missing?

Thanks,

Dennis