Skip to content

support for xhr.status + correctly trigger ajaxError handlers #72

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

Merged
merged 6 commits into from
May 23, 2011

Conversation

kares
Copy link
Contributor

@kares kares commented Mar 23, 2011

hey malsup,

i did found it very limiting not having a xhr.status when doing an ajax file upload ...
since there's a <textarea> hack anyway i thought why not add another "hack" to receive the status (and statusText as well), here's what i did :

  • i check for the status attribute on the document root (e.g. <body>)
  • if the <textarea> hack is used i check for the status attribute on it as well
  • it no status attribute everything stays as before : xhr.status === 'n/a'

now after adding this i discovered that even thought the xhr.status was being set correctly i still had issues with the ajaxError handler not being triggered correctly ... thus i changed the "status" handling logic a bit and now it's working flawlessly - so i thought it might be useful for others as well :)

K.

kares added 2 commits March 23, 2011 17:20
@honzasterba
Copy link

+1

@malsup
Copy link
Collaborator

malsup commented May 22, 2011

This doesn't work correctly for the default case of no status attribute on the body or textarea. In that case, the status code remains zero and causes the status text to be 'error' which triggers the error handling logic.

@kares
Copy link
Contributor Author

kares commented May 23, 2011

Fixed, thanks. I wasn't testing the code without the (server-side) "status" hack as I should have ...

@malsup malsup merged commit 949a17f into jquery-form:master May 23, 2011
@malsup
Copy link
Collaborator

malsup commented May 23, 2011

Merged. Thanks!

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

Successfully merging this pull request may close these issues.

3 participants