likerrr / jq-ajax-progress Goto Github PK
View Code? Open in Web Editor NEWjQuery plugin that adds support of `progress` promise
License: MIT License
jQuery plugin that adds support of `progress` promise
License: MIT License
When this plugin is used alongside jQuery UI Autocomplete it breaks the xhr.abort() functionality inside of it.
"Uncaught TypeError: that.xhr.abort is not a function"
Relevant line in jQuery UI Autocomplete: https://github.com/jquery/jquery-ui/blob/4866e14922217560f551b86ce80952c3e0f649da/ui/widgets/autocomplete.js#L399
Have you experienced issue with uploadProgress
callback did not get invoke at all during upload?
cc @likerRr
Hi, sorry if this is the wrong forum for this - but how do you use this with browserify?
I've tried just require()-ing the module right after my jQuery is loaded, but it doesn't add the methods to promises created through $.ajax()
var $ = require('jquery');
window.$ = window.jQuery = $;
require('jq-ajax-progress');
Then I set up the $.ajax as usual:
var promise = $.ajax({
url: getApiUri(),
type: 'POST',
...
});
But then promise.uploadProgress is not a function
when I want to pass a function to it. Indeed if I inspect the promise, it has no function called uploadProgress
. But I can see that the code is ran where it replaces the "old" $.ajax
.
Hi guys,
First of all thanks for your work on this plugin. I'm facing issues due to the mutation that are being done inside this library. Specifically in Mac OS Safari (15) it causes the first request to return the old headers from the initial request. I checked and it's due to how we are mutating the options to have this new function that relies on a preinitialized xmlHttpReq variable:
options.xhr = function () {
so what I'm doing is something like this:
const requestParams = {url:....};
const jqXHR = $.ajax(requestParams);
return Promise.resolve(jqXHR)
.catch(() => {
if (shouldRetry) {
return $.ajax(requestParams); //Due to the mutation this will end up returning an object with the wrong headers because it is reusing the same xmlHttpReq variable of the first call and safari doesn't clean those up.
});
From my end I could avoid this by doing a clone of the requestParams, but I reckon we should be mutating this object for the user.
Hi.
I have been using your plugin on my latest projects, and it always worked fine ...
well... almost always :S
I never had problems on most common desktop browsers.
Also on Chrome (x Android) seems to work fine.
But i just discovered that, on Firefox (x Android), the uploadProgress()
callback is NEVER executed!
I hope this project is still mantained and issues checked ;))
Anyway, thanks for your job!
console.log("start");
var rand = '&rand='+Math.round(new Date().getTime() / 1000);
var component_url = jQuery('#component_url').val();
jQuery.ajax(component_url+'&task=install.downloadWgiz'+rand).progress(function(e) {
console.log("progress");
console.log(e);
}).uploadProgress(function(e) {
// tracking uploading
// if (e.lengthComputable) {
// var percentage = Math.round((e.loaded * 100) / e.total);
// console.log(percentage);
});
console.log("end");
Thats's my code. Vars "rand" and "component_url" are working as expected. The ajax is getting called normally but i'm unable to see those two console logs inside the ".progress" function.
"console.log('start');" and "console.log('end');" are working as well.
Why?
Hi,
Thanks for the plugin. Noticing chrome jumps to 100% instantly when trying to upload a base64 video/image. Does this need to be converted back to a BLOB in order for the progress callback to behave as expected?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.