PDA

View Full Version : [2.0b1] Ajax's getResponseHeader funkey in IE



ALL
16 Oct 2007, 4:37 PM
It's pretty simple, in IE (or atleast IE7) it leaves a \r (character 13) at the end of each item returned by getResponseHeader in the ajax lib.

I have an example, but it is really elaborite, and dont really have the time to shorten it up.

Here is pretty much what i have though:

Ext.Ajax.request({
url: 'save.php',
success: function (response){
// File may not have been saved need to check what the php file returned
// Right here, in FireFox this would work fine, but in IE you would need: 'failed\r' because it appends a \r to the end of all the headers.
if(response.getResponseHeader.Status === 'failed'){
//ERROR
Ext.MessageBox.show(
{
title: 'Could not save file...',
msg: 'There was an error saving the file. The following message was sent:<br/><br/>ERROR: '+response.responseText,
buttons: Ext.MessageBox.OK,
multiline: false,
icon: Ext.MessageBox.ERROR
}
)
}else{
Ext.MessageBox.show(
{
title: 'File Saved...',
msg: 'Sucessfully saved your file(s)!',
buttons: Ext.MessageBox.OK,
multiline: false,
icon: Ext.MessageBox.INFO
}
)
}
},
This is really easy to work around, but i just thought it might save another person some time in the future.

Thanks,
-ALL

jsakalos
18 Oct 2007, 5:59 PM
Ext doesn't append \r after the header. I would say that this header coming from server has
\r\n appended (windows new line) and \r is not stripped.

Could you please check what server really sends?

ALL
19 Oct 2007, 10:59 AM
Ext doesn't append \r after the header. I would say that this header coming from server has
\r\n appended (windows new line) and \r is not stripped.

Could you please check what server really sends?

That's what i was betting was happening, I was just stating that it might be bennifical to strip the \r if the server sends it. I am not sure how you are getting the headers; if it comes in a group and you are split()ing it or if it comes in that form already. if you are spliting it, it might be a good idea to do something more on the lines of: headers.split(/(\r\n|[\r\n])/);

And yes i am running windows so i'm sure it was passing \r\n.

jsakalos
19 Oct 2007, 11:13 AM
Thank you. We will consider the possibility to implement the \r\n stripping logic.

cutelaw
20 Jan 2009, 2:45 AM
Thank you. We will consider the possibility to implement the \r\n stripping logic.

What about this enhancement? In ExtJS2.2 this issue is still existing, and it caused us some frustrating time to find out.

Best regards