52,797
社区成员
发帖
与我相关
我的任务
分享
form.submit( {
url: 'go?handler=uploadFile',
waitMsg : 'waiting.....',
success : function(form, action) {
alert("hzb");
Ext.Msg.alert('Tips', "<font color='green'>"
+ action.result.msg + "</font>");
},
failure : function(form, action) {
Ext.Msg.alert('Tips', "<font color='red'>"
+ action.result.msg + "</font>");
}
});
{
xtype: 'form',
id: 'book_add_formpan',
url: '../AddBook',
....
}
Ext.getCmp('book_add_formpan').submit({success:function(){
Ext.Msg.alert("success");
Ext.getCmp("book_add_win").close();}});
这样是可以的 4.2.1版本Ext.onReady(function () {
Ext.define('ImagePanel', {
extend: 'Ext.form.Panel',
fileUpload: true,
title: 'Upload Panel',
width: 300,
height: 100,
onUpload: function () {
this.getForm().submit({
url: 'upload.php',
scope: this,
success: function (formPanel, action) {
var data = Ext.decode(action.response.responseText);
alert("Success: " + data.msg);
},
failure: function (formPanel, action) {
var data = Ext.decode(action.response.responseText);
alert("Failure: " + data.msg);
}
});
},
initComponent: function () {
var config = {
items: [
{
xtype: 'fileuploadfield',
buttonText: 'Upload',
name: 'uploadedFile',
listeners: {
'change': {
scope: this,
fn: function (field, e) {
this.onUpload();
}
}
}
}
]
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
this.callParent(arguments);
}
});
var panel = Ext.create('ImagePanel', {
renderTo: Ext.getBody()
});
});
记住返回时加双引号的
{"success": false, "msg": "No Files"}
<form enctype="multipart/form-data">
</from>
设置了么?