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

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

Merged
merged 6 commits into from May 23, 2011

Conversation

Projects
None yet
3 participants
@kares
Copy link
Contributor

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 some commits Mar 23, 2011

@honzasterba

This comment has been minimized.

Copy link

honzasterba commented Apr 21, 2011

+1

@malsup

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

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