PDA

View Full Version : Definition of "Success" in Ext.Ajax?



cstansbury
31 Aug 2010, 8:24 AM
Browser: Firefox v3.6.8
Ext v3.1.1

I had assumed that only a request whose response code was in the 200 range would be considered "successful", but I'm getting my success callback invoked for requests that return a 413 (Entity too large)...

I've verified in Firebug (see following screenshot).

22191

Either I'm doing something wrong (likely), or I've misinterpreted Ext.Ajax's definition of success?

cstansbury
31 Aug 2010, 8:35 AM
Oops, I just noticed the following in the docs:


File uploads are not performed using normal "Ajax" techniques, that is they are not performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the DOM <form> element temporarily modified to have its target (http://www.w3.org/TR/REC-html40/present/frames.html#adef-target) set to refer to a dynamically generated, hidden <iframe> which is inserted into the document but removed after the return data has been gathered.

I suspect that the fact that I'm performing a file upload (which is alluded to in the screenshot above, but not explicitly called out) is the problem, and that I'll have to parse out the responseXml to ascertain whether or not it was really successful? If so, can someone confirm?

Thanks, Chad

Animal
31 Aug 2010, 9:56 AM
Yes, you can't know any HTTP status code from a file upload. It's a form submission directed to an iframe. You will need to access the responseXML which is put in the fake XHR