]> source.dussan.org Git - jquery.git/commitdiff
Errors were occuring with getScript, if you called it too early.
authorJohn Resig <jeresig@gmail.com>
Sun, 9 Sep 2007 18:09:27 +0000 (18:09 +0000)
committerJohn Resig <jeresig@gmail.com>
Sun, 9 Sep 2007 18:09:27 +0000 (18:09 +0000)
src/ajax.js

index ffe30481d37e956024115124454c52801b82f9eb..ef9504887dce9ae7781d41074575d4d93a87b6f9 100644 (file)
@@ -214,6 +214,7 @@ jQuery.extend({
                // If we're requesting a remote document
                // and trying to load JSON or Script
                if ( !s.url.indexOf("http") && s.dataType == "script" ) {
+                       var head = document.getElementsByTagName("head")[0];
                        var script = document.createElement("script");
                        script.src = s.url;
 
@@ -228,12 +229,12 @@ jQuery.extend({
                                                done = true;
                                                success();
                                                complete();
-                                               document.body.removeChild( script );
+                                               head.removeChild( script );
                                        }
                                };
                        }
 
-                       document.body.appendChild(script);
+                       head.appendChild(script);
 
                        // We handle everything using the script element injection
                        return;