PDA

View Full Version : [CLOSED]success/failure callbacks for Ajax requests with isUpload:true



jeroenooms
1 Jun 2010, 1:09 AM
I noticed that when using an ajax request with parameter isUpload: true (hence actually using the hidden iFrame method), the call is always successful, even when the request actually fails. For example, if you post a form to an non existing location, and hence get a 404, the success callback is still fired, and not the failure callback:

Ext.Ajax.request({
form: 'uploadform',
isUpload: true,
url: '/sdfdsfsd/sdfsdfds/sdffsd',
success: function(x) {alert('success')},
failure: function(x) {alert('failure')},
callback: function(x) {alert('callback')}
});
I'm not sure if this is a bug in Ext or just a limitation of the hidden iFrame method, but it might be worth documenting this under the 'isUpload' option in the Ajax.request manual page.

evant
1 Jun 2010, 2:40 AM
You can't do things like check the response codes in Javascript, the best you can do is perhaps check the content that was returned in the frame, say for an error message.

I'll make a note in the docs.