Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different submit behavior when using uploadProgress #305

Closed
confile opened this issue Mar 24, 2013 · 14 comments
Closed

Different submit behavior when using uploadProgress #305

confile opened this issue Mar 24, 2013 · 14 comments

Comments

@confile
Copy link

confile commented Mar 24, 2013

I use ajaxSubmit to submit a form to a third party url. I use the following code.

$("#uploadToYoutubeForm").ajaxSubmit({
                            url: "http://www.example.com?nexturl=someurl",
                            type: 'post',

                           uploadProgress: function(event, position, total, percentComplete) {

                            },

                           complete: function(response){
                                        alert("complete");                      
                            }
                        });

My problem is that there is a different behavior when I use uploadProgress. The server executes the nexturl only when I do not use uploadProgress. When I use uploadProgress the nexturl will not be called.

What can I do?

@confile
Copy link
Author

confile commented Mar 27, 2013

@malsup Do you have an idea?

@malsup
Copy link
Collaborator

malsup commented Mar 28, 2013

No. That's extremely odd.

@confile
Copy link
Author

confile commented Mar 28, 2013

@malsup so what should I do about it?

@malsup
Copy link
Collaborator

malsup commented Mar 28, 2013

What browser are you using? Are there any errors in the console? Is your uploadProgress callback invoked?

@confile
Copy link
Author

confile commented Mar 28, 2013

@malsup Chrome Version 26.0.1410.43 MAC OSX 10.8.3.

No Errors in the console. uploadProgress worked fine. I get a perfect progress bar.

@malsup
Copy link
Collaborator

malsup commented Mar 28, 2013

Is the server receiving the file? Do you get a response?

@confile
Copy link
Author

confile commented Mar 28, 2013

@malsup
The only part I add is the following:

uploadProgress: function(event, position, total, percentComplete) {
                                $("#ajax-videouploader").hide();
                                $("#progressbar").progressbar({
                                    value : percentComplete
                                });
                                $(".progress-label").html(percentComplete+" %");
}

The progress bar works fine. The uploaded file is stored on the server, but the server does not send a request back when I added the above code.

Do you have an idea?

@malsup
Copy link
Collaborator

malsup commented Mar 28, 2013

Sorry, don't know what to suggest. I'm not able to duplicate the issue on a similar cors setup:

http://malsup.github.com/demo/progress.html

The server response is consistently received by the client.

@ajwinkworth
Copy link

I am also having this issue. Using Fiddler I can see that the server is sending a redirect response but the request maintains a pending type and (eventually) cancelled status. The chrome client never sees a response. It eventually turns from pending to cancelled. I also have narrowed it down 100% to adding the handler for uploadProgress as adding/removing the handler will add/remove the issue. I also get a good progress reporting. The response from the server is a 303 with new location(back to my server). Works fine in IE10? (wtf when does that ever happen). File is received fine by S3 (the CORS server).

@ajwinkworth
Copy link

Oh after looking at your(malsup's) code to reproduce you should add the 303 redirect as response as that is also in the mix of the problem.

@confile
Copy link
Author

confile commented Mar 31, 2013

@ajwinkworth where should I add it?

@ajwinkworth
Copy link

If it helps.. adding an progress handler makes the cors do a preceeding options request (which passes) where without progress handler it doesn't.

@ajwinkworth
Copy link

I am chrome: Version 25.0.1364.172 m on Windows 7 64

@ajwinkworth
Copy link

@confile Sorry my poor writing at 1am was to do with malsups attempt at recreation of the issue. The server your sending your (@confile) request too would be redirecting also back to your server(or whatever nexturl is). So this issue involves CORS, uploadProgress Handler, and Redirection of CORS request as CORS seems to work without redirection. Its almost as if the xhr forgets how to redirect if you add an uploadProgress handler. ?

@kevindb kevindb closed this as completed Feb 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants