aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ajax.js5
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;