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

.ajax processing 2xx responses with no data as an error #3

Closed
pecknigel opened this issue Sep 3, 2017 · 4 comments
Closed

.ajax processing 2xx responses with no data as an error #3

pecknigel opened this issue Sep 3, 2017 · 4 comments

Comments

@pecknigel
Copy link

pecknigel commented Sep 3, 2017

The .ajax feature is handling a 204 response as an error, when it should be handled by success. As should any 2xx code.

@nolimits4web
Copy link
Owner

According to this line https://github.com/nolimits4web/Dom7/blob/master/src/ajax.js#L210 all 2xx responses are treated as success, maybe error somewhere else?

@pecknigel
Copy link
Author

It's definitely a 204 and getting handled by the error callback. I am logging the xhr object to the console from there and status is 204.

@pecknigel
Copy link
Author

pecknigel commented Oct 1, 2017

I just had this problem again, and this time with a 200 response! Lol, so I was wrong that it was due to the response code, as you pointed out. What it does seem to be to do with is when there is no data in the response. I added data to my response and that fixed it, and of course a 204 has no data. A 2xx response with no data is handled as an error. Perhaps only when encode is set to true, but haven't tested without it.

@pecknigel pecknigel changed the title .ajax processing 204 response as an error .ajax processing 2xx responses with no data as an error Oct 1, 2017
@nolimits4web
Copy link
Owner

Closing as not relevant anymore

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

2 participants