3 // Install script dataType
6 script: "text/javascript, application/javascript"
12 "text script": function( text ) {
13 jQuery.globalEval( text );
19 // Handle cache's special case and global
20 jQuery.ajaxPrefilter( "script", function( s ) {
21 if ( s.cache === undefined ) {
24 if ( s.crossDomain ) {
30 // Bind script tag hack transport
31 jQuery.ajaxTransport( "script", function(s) {
33 // This transport only deals with cross domain requests
34 if ( s.crossDomain ) {
37 head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement;
41 send: function( _, callback ) {
43 script = document.createElement( "script" );
45 script.async = "async";
47 if ( s.scriptCharset ) {
48 script.charset = s.scriptCharset;
53 // Attach handlers for all browsers
54 script.onload = script.onreadystatechange = function( _, isAbort ) {
56 if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) {
58 // Handle memory leak in IE
59 script.onload = script.onreadystatechange = null;
62 if ( head && script.parentNode ) {
63 head.removeChild( script );
66 // Dereference the script
69 // Callback if not abort
71 callback( 200, "success" );
75 // Use insertBefore instead of appendChild to circumvent an IE6 bug.
76 // This arises when a base node is used (#2709 and #4378).
77 head.insertBefore( script, head.firstChild );
82 script.onload( 0, 1 );