This jQuery plugin provides access to the onprogress event of the XMLHttpRequest
object available
in modern browsers. It has been tested in recent versions of Chrome/Chromium and in Firefox 4.
This plugin requires jQuery 1.5 or higher.
Add the script to the page's list of <script>
tags after the jQuery reference.
In your page code, check the value of jQuery.support.ajaxProgress
. If this value is false, then the browser doesn't
support the onprogress
event, so you'll have to write fallback code (for example, showing a generic progress spinner
instead of a percentage).
The plugin exposes the onprogress
event in two ways:
As a global AJAX event that you can subscribe to.
The handler signature is function ( jqEvent, progressEvent, jqXHR )
, where jqEvent
is the the event object created by
jQuery, progressEvent
is the native object conforming to the
(ProgressEvent interface)[http://www.w3.org/TR/progress-events/#interface-progressevent], and jqXHR
is the original
(wrapper around the XMLHttpRequest object)[http://api.jquery.com/jQuery.ajax/#jqXHR].