Over a million developers have joined DZone.

Transfer Binary Data and Track Upload Progress with a New XMLHttpRequest Level 2 Ajax library, xhr2-lib

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

So a while ago a messed about with the File API and FormData with the XMLHttpRequest Level 2 spec which enables the transfer of binary data and tracking of the upload progress through the XMLHttpRequestUpload object – awesome. I was blown away when I first started messing about with this stuff and support for it now seems to be a little more wide spread, nothing in IE or Opera as of yet but you know life goes on. What I did start to do was abstract some of the code I was messing about with into a little module aptly named xhr2-lib which I’ve grown a bit since and would like to share and hopefully get some feedback.

This micro library follows the example of the jQuery Ajax api with many of the same function names, I’m not suggesting it is anywhere near as comprehensive but I wanted a familiar set of tools to work with. I have put in the short cut methods like .getJSON and .post and am at the stage now of fleshing out the core and adding some tests and examples. Please check out the code and documentation on Github for now and I will add some demos here over the coming couple of weeks.

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.


Published at DZone with permission of Phil Parsons, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}