Simple patch that adds a 'progress' callback to jquery Ajax calls
Switch branches/tags
Nothing to show
Clone or download
Latest commit ff6bf25 Feb 23, 2018
Failed to load latest commit information.
data Initial commit Sep 21, 2012
js Fix #4, preserve context when calling `oldXHR`. Jun 20, 2017
LICENSE Add license file. Feb 23, 2018 Added notes to README Sep 21, 2012
demo.html Initial commit Sep 21, 2012

Jquery Ajax Progresss

A simple patch to jQuery that will call a 'progress' callback, using the XHR.onProgress event


Simply include the script on your page:

<script src="js/jquery.ajax-progress.js"></script>

Then, whenever you make an ajax request, just specify a progress callback:

    method: 'GET',
    url: 'data/bird.json',
    dataType: 'json',
    success: function() { },
    error: function() { },
    progress: function(e) {
        //make sure we can compute the length
        if(e.lengthComputable) {
            //calculate the percentage loaded
            var pct = (e.loaded / * 100;

            //log percentage loaded
        //this usually happens when Content-Length isn't set
        else {
            console.warn('Content Length not reported!');

You can see it in action on the demo.html page.