Created
November 25, 2014 02:30
-
-
Save rmdort/e31ae31a1eed10def372 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Create transport if the browser can provide an xhr | |
| if ( xhrSupported ) { | |
| jQuery.ajaxTransport(function( options ) { | |
| // Cross domain only allowed if supported through XMLHttpRequest | |
| if ( !options.crossDomain || support.cors ) { | |
| var callback; | |
| return { | |
| send: function( headers, complete ) { | |
| var i, | |
| xhr = options.xhr(), | |
| id = ++xhrId; | |
| // Open the socket | |
| xhr.open( options.type, options.url, options.async, options.username, options.password ); | |
| // Apply custom fields if provided | |
| if ( options.xhrFields ) { | |
| for ( i in options.xhrFields ) { | |
| xhr[ i ] = options.xhrFields[ i ]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment