[thelist] What is the best way to insert content in a page from a remote .js file ?

Christian Heilmann lists at onlinetools.org
Sun Feb 13 08:37:48 CST 2005


Peter wrote:

> Hi,
>
> What is the best way to insert content in a page from a remote .js file ?
>
> I tried:
>
> 1. To define functions and variables in the .js file and call them 
> from the page => did not work since it takes a lot to load the .js(.js 
> file is created on the fly with PHP)
> 2. To make DIV tags in the main page and when  .js file is loaded to 
> modify their content from the .js file. It did not work although the  
> same JS code copied and pasted in the main page worked.
>
> What is your advice ?
>
> Thanks in advance for your help
>
> Peter

Without knowing the javascript this  is very hard to answer. My stance, 
however, is to avoid inline Javascript, as it simply is dirty.

This might help: 
http://www.onlinetools.org/articles/unobtrusivejavascript/chapter1.html



More information about the thelist mailing list