diff options
author | John Resig <jeresig@gmail.com> | 2007-09-09 18:09:27 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2007-09-09 18:09:27 +0000 |
commit | 4e504d86b9dc9e1501f598744f6c3b19f834c487 (patch) | |
tree | 4ae6b4413c5018ae719ff9885c8d37ca4fe152b1 /src/ajax.js | |
parent | 97fe63cb4826cbeb74bc0c3a72648f57ae0f0881 (diff) | |
download | jquery-4e504d86b9dc9e1501f598744f6c3b19f834c487.tar.gz jquery-4e504d86b9dc9e1501f598744f6c3b19f834c487.zip |
Errors were occuring with getScript, if you called it too early.
Diffstat (limited to 'src/ajax.js')
-rw-r--r-- | src/ajax.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ajax.js b/src/ajax.js index ffe30481d..ef9504887 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -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; |