Ticket #11555 (closed bug: notabug)
jQuery.ajaxTransport.send.callback doesn't get called for readyState = 2 with Chrome
|Reported by:||mbeelen@…||Owned by:||mbeelen@…|
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.
- Owner set to jaubourg
- Priority changed from undecided to low
- Status changed from new to assigned
- Component changed from unfiled to ajax