form.action.Submit.method
here
代码:
{
xtype: 'form',
items: [
{
xtype: 'filefield',
name: 'foo_name',
buttontext: 'foo_select'
},
],
buttons: [{
text: 'Extract',
handler: function() {
var form = this.up('form').getForm();
if (form.isValid()) {
form.submit({
url: 'excel-extraction-service',
method: 'GET'
});
}
}
}]
}
服务器日志:
POST /excel-extraction-service 404
我正在尝试在我的服务器上使用excel解析/提取服务。该服务接受一个excel文件,对其进行pareses,并返回一个json表示。 GET的原因> POST是GET是一个安全方法,不应该改变服务器的状态。
帮助?提前致谢
编辑:请务必注意表单中包含filefield
,因此上传不会通过普通的AJAX(文档here)处理。似乎此过程会覆盖method
配置中的form.submit
属性。
答案 0 :(得分:1)
没有。这是最新版本的示例。当你在控制台中查看时,你会看到它发送一个get请求。发布测试用例。
Ext.require('*');
Ext.onReady(function() {
var fp = new Ext.form.Panel({
renderTo: document.body,
items: [{
xtype: 'textfield',
name: 'foo'
}]
});
fp.getForm().submit({
url: 'foo',
method: 'GET'
});
});