// 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;
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;