https://github.com/bharathvaj-ganesan/jquery-ajax-progress
A simple patch to jQuery that will call a 'progress' callback, using the XHR.onProgress event
https://github.com/bharathvaj-ganesan/jquery-ajax-progress
ajax jquery jquery-plugin progress
Last synced: 10 months ago
JSON representation
A simple patch to jQuery that will call a 'progress' callback, using the XHR.onProgress event
- Host: GitHub
- URL: https://github.com/bharathvaj-ganesan/jquery-ajax-progress
- Owner: bharathvaj-ganesan
- License: mit
- Created: 2018-01-14T10:57:11.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-14T12:58:53.000Z (almost 8 years ago)
- Last Synced: 2025-01-12T10:27:30.070Z (12 months ago)
- Topics: ajax, jquery, jquery-plugin, progress
- Language: JavaScript
- Homepage:
- Size: 73.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# JQUERY AJAX PROGRESS PLUGIN
> A simple patch to jQuery that will call a 'progress' callback, using the XHR.onProgress event
### Getting started
```html
```
### Usuage
```js
$.ajax({
method: 'GET',
url: 'data/bird.json',
dataType: 'json',
success: () => {
console.log('Success');
},
error: () => {},
progress:event=> {
//make sure we can compute the length
if event.lengthComputable) {
//calculate the percentage loaded
const pct = event.loaded / event.total * 100;
// You can display or make use of the percentage loaded
console.log(pct);
} else {
//this usually happens when Content-Length isn't set
console.warn('Content Length not reported!');
}
}
});
```
## License
MIT © [Bharathvaj Ganesan](https://github.com/bharathvaj1995)