3 // Install script dataType
7 script: "text/javascript, application/javascript"
15 "text script": jQuery.globalEval
18 // Handle cache's special case and global
19 }).ajaxPrefilter("script", function(s) {
21 if ( s.cache === undefined ) {
25 if ( s.crossDomain ) {
29 // Bind script tag hack transport
30 }).ajaxTransport("script", function(s) {
32 // This transport only deals with cross domain requests
33 if ( s.crossDomain ) {
36 head = document.getElementsByTagName("head")[0] || document.documentElement;
40 send: function(_, callback) {
42 script = document.createElement("script");
44 script.async = "async";
46 if ( s.scriptCharset ) {
47 script.charset = s.scriptCharset;
52 // Attach handlers for all browsers
53 script.onload = script.onreadystatechange = function( _ , isAbort ) {
55 if ( ! script.readyState || /loaded|complete/.test( script.readyState ) ) {
57 // Handle memory leak in IE
58 script.onload = script.onreadystatechange = null;
61 if ( head && script.parentNode ) {
62 head.removeChild( script );
65 // Dereference the script
68 // Callback if not abort
70 callback( 200, "success" );
74 // Use insertBefore instead of appendChild to circumvent an IE6 bug.
75 // This arises when a base node is used (#2709 and #4378).
76 head.insertBefore( script, head.firstChild );