> > Why not use document.createElement("script") !?

> Because we want jQuery to wait until the script is loaded and 
> evaluated, so it's possible to do something upon completion, 
> like continuing the normal flow of the program. This is 
> necessary for example for writing a require like the one in PHP.

You can't do that, and you wouldn't want to if you could. JavaScript doesn't
work that way. If you were successful in getting JavaScript to wait until a
script is loaded, the entire browser would be locked up in the meantime.

What you *could* do is something like this:

   require( script, completion );

e.g.

   require( 'test.js', function() {
      // This code runs when the script is loaded
   });

-Mike


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to