PDA

View Full Version : Add header to form submit



alona.oz
5 Feb 2013, 6:26 AM
Hi,

I have Ext.form.Panel that submits request to server. I need to add custom header to request.
How I can do it?

10x

Here is my code


var form = Ext.create('Ext.form.Panel', {
frame: true,
url:'/diamond/rest/api/V2/experiences/'+expId+'/attachments/files/'+file.getId()+'/data',
standardSubmit:true,
items: [
{
xtype: 'textfield',
name: 'downloadUrl',
value:file.data.contentResource
},
{
xtype: 'textfield',
name: 'mimeType',
value: file.data.mimeType
},
{
xtype: 'textfield',
name: 'fileName',
value: file.data.fileName
},
{
xtype: 'textfield',
name: 'cookie',
value:_document.cookie
}
]
});



form.submit({
success: function(form, action) {
Ext.getBody().unmask();
Ext.Msg.alert('Success', action.result.message);
},
failure: function(form, action) {
Ext.getBody().unmask();
Ext.Msg.alert('Failed', action.result ? action.result.message : 'No response');
}
});

sword-it
5 Feb 2013, 7:02 AM
Hi,
you can see this link :http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.proxy.Ajax-cfg-headers

alona.oz
5 Feb 2013, 10:27 PM
I don't use Ajax since I want to download image data and display it after response.
So till now I used form.submit and the result was loaded into separated iframe, now I want to add header to HTTP request and I can't find how to do it.
Do you know how to do it differently (using Ajax call?) with possibility to add headers?

10x