What is the output when you fire this:

function loadJavascript(scriptFile) {
        var scriptsPath;

        // Builds the correct scripts path
        scriptsPath = $('script').attr('src');
        scriptsPath = scriptsPath.replace(/\w+\.js$/, '');

        $.getScript(scriptsPath + scriptFile + ".js", function(data,
textStatus){
                alert('status of request was: ' + textStatus);
        });
}



On Jan 16, 3:17 pm, Nazgulled <[EMAIL PROTECTED]> wrote:
> Any hints why $.getScript() is not working as it should?
>
> On Jan 15, 11:28 pm, Jeroen <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jan 16, 2008 12:20 AM, Nazgulled <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
> > > I'm trying to load JS files (libraries) dynamically at run-time with
> > > jQuery but I'm not being able to...
>
> > AFAIK browsers do not support loading external JS after the DOM has loaded.
> > I think this is the reason for the $.getScript("script.js", function(){ do
> > stuff...   }); function.
>
> > I use this in my projects and it works great and is a much cleaner
> > alternative. You could
> > even bind it to an event so it only get's loaded after the event is
> > triggered (very cool).
>
> > --
> > Jeroen- Hide quoted text -
>
> - Show quoted text -

Reply via email to