Skip to content

Instantly share code, notes, and snippets.

View vzaidman's full-sized avatar

Vitali Zaidman vzaidman

View GitHub Profile
@vzaidman
vzaidman / jquery-ajax-blob-arraybuffer.js
Last active August 29, 2015 14:23 — forked from SaneMethod/jquery-ajax-blob-arraybuffer.js
The branch supports headers and fixed stack overflows in aborting and creating response.
/**
* Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2
* within the comfortable framework of the jquery ajax request, with full support for promises.
*
* Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list
* of potential transports (so it gets first dibs if the request passes the conditions within to provide the
* ajax transport, preventing the standard transport from hogging the request), and the * indicates that
* potentially any request with any dataType might want to use the transports provided herein.
*
* Remember to specify 'processData:false' in the ajax options when attempting to send a blob or arraybuffer -