3 // Install script dataType
7 script: "text/javascript, application/javascript"
15 "text script": jQuery.globalEval
19 // Handle cache's special case and global
20 jQuery.ajaxPrefilter("script", function(s) {
22 if ( s.cache === undefined ) {
26 if ( s.crossDomain ) {
32 // Bind script tag hack transport
33 jQuery.ajaxTransport("script", function(s) {
35 // This transport only deals with cross domain requests
36 if ( s.crossDomain ) {
39 head = document.getElementsByTagName("head")[0] || document.documentElement;
43 send: function(_, callback) {
45 script = document.createElement("script");
47 script.async = "async";
49 if ( s.scriptCharset ) {
50 script.charset = s.scriptCharset;
55 // Attach handlers for all browsers
56 script.onload = script.onreadystatechange = function( _ , isAbort ) {
58 if ( ! script.readyState || /loaded|complete/.test( script.readyState ) ) {
60 // Handle memory leak in IE
61 script.onload = script.onreadystatechange = null;
64 if ( head && script.parentNode ) {
65 head.removeChild( script );
68 // Dereference the script
71 // Callback if not abort
73 callback( 200, "success" );
77 // Use insertBefore instead of appendChild to circumvent an IE6 bug.
78 // This arises when a base node is used (#2709 and #4378).
79 head.insertBefore( script, head.firstChild );