Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | define( [ |
| 2 | "../ajax" |
| 3 | ], function( jQuery ) { |
| 4 | |
| 5 | "use strict"; |
| 6 | |
| 7 | jQuery._evalUrl = function( url, options ) { |
| 8 | return jQuery.ajax( { |
| 9 | url: url, |
| 10 | |
| 11 | // Make this explicit, since user can override this through ajaxSetup (#11264) |
| 12 | type: "GET", |
| 13 | dataType: "script", |
| 14 | cache: true, |
| 15 | async: false, |
| 16 | global: false, |
| 17 | |
| 18 | // Only evaluate the response if it is successful (gh-4126) |
| 19 | // dataFilter is not invoked for failure responses, so using it instead |
| 20 | // of the default converter is kludgy but it works. |
| 21 | converters: { |
| 22 | "text script": function() {} |
| 23 | }, |
| 24 | dataFilter: function( response ) { |
| 25 | jQuery.globalEval( response, options ); |
| 26 | } |
| 27 | } ); |
| 28 | }; |
| 29 | |
| 30 | return jQuery._evalUrl; |
| 31 | |
| 32 | } ); |