If you are using files local to your server and are interested in XHR +eval I posted a partial port of JSAN to jQuery at the end of this thread http://groups.google.com/group/jquery-en/browse_frm/thread/258363a3aaf2a916/
The key there is the load is 'async: false' which means that the execution waits until the external script is loaded before continuing. Just another option... On Jul 20, 12:57 pm, Chrisss <[EMAIL PROTECTED]> wrote: > Hello, > > I was wondering if jQuery can be used to load javascript dynamically, > on an as-needed basis. Here is the problem I have: > > I want to load a page with as little javascript as possible. When > someone clicks on an item that requires some javascript functionality, > I want it to load a javascript function from an external file and then > execute it. > > While there is some simple javascript I've found that can do this kind > of thing by appending the script to the DOM, it can't do things in > order. For instance, I want to load the function, and then execute it. > To do so, the javascript has to have some way to check if the funciton > exists. I don't like the idea of doing a time-out loop, so I was > wondering if jQuery has something built in for this kind of thing. > > Thank you! > Chris