Ticket #11555 (closed bug: notabug)
jQuery.ajaxTransport.send.callback doesn't get called for readyState = 2 with Chrome
| Reported by: | mbeelen@… | Owned by: | mbeelen@… |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | ajax | Version: | 1.7.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
In my application I make a call to the server using a jQuery.post().
My application sometimes returns a HttpResponse with status 406 in case the data provided in the request isn't acceptable. The response also contains additional HttpResponse headers, which contain an application specific errorCode and message. In my application I want to use the global ajaxError for reading the headers and inform the user about what went wrong.
In IE and Firefox this works fine, but in Chrome and Safari it fails. After doing some debuging I notice the main difference are the values of the jqXHR. In IE and FF the status will be 406 but reading the value in Chrome will return 0 and the responseHeaderString remains empty.
I notice that these values are being read from the standard xhr in the callback of ajaxTransport.send. (Starting from line 8105)
By putting a breakpoint within that callback I noticed that in Firefox the execution will hit the breakpoint twice: Once with readyState = 2 and once with readyState = 4. For some caching purpose jQuery will only read the headers when the readyState = 2.
In Chrome the breakpoint will only be hit once and the readyState = 4 at that moment, which results in the information of the headers not being present for my application, due to the caching of headers.
Change History
comment:1 Changed 13 months ago by rwaldron
- Owner set to jaubourg
- Priority changed from undecided to low
- Status changed from new to assigned
- Component changed from unfiled to ajax
comment:2 Changed 13 months ago by jaubourg
- Owner changed from jaubourg to mbeelen@…
I'd love to see a reduced test case for this, given we don't do anything for readyState 2 in jQuery, only readyState 4, so I'm a bit lost here.
comment:3 follow-up: ↓ 4 Changed 10 months ago by anonymous
Uncaught ReferenceError: calisan_listele is not defined $.ajax.success jQuery.Callbacks.fire jquery-1.7.2.js:1075 jQuery.Callbacks.self.fireWith jquery-1.7.2.js:1193 done jquery-1.7.2.js:7538 jQuery.ajaxTransport.send.callback
comment:4 in reply to: ↑ 3 Changed 10 months ago by jaubourg
Replying to anonymous:
Uncaught ReferenceError: calisan_listele is not defined $.ajax.success jQuery.Callbacks.fire jquery-1.7.2.js:1075 jQuery.Callbacks.self.fireWith jquery-1.7.2.js:1193 done jquery-1.7.2.js:7538 jQuery.ajaxTransport.send.callback
That's not a test case. And calisan_listele is not used in jQuery, the error is thrown from your own callback (ie. your own code).
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
