我能够在 firebug 中看到 json 响应,但是当我成功解码表单的 ACTION 时,它给出了 undefined 。
{
xtype: 'form',
x: 30,
y: 520,
height: 80,
bodyPadding: 10,
title: 'myuploadform',
fileUpload: true,
standardSubmit: false,
autoHeight: true,
bodyStyle: 'padding: 10px 10px 10px 10px;',
labelWidth: 50,
items:[{
xtype: 'fileuploadfield',
id: 'filedata',
emptyText: 'Select a document to upload...',
fieldLabel: 'File',
buttonText: 'Browse'
}],
buttons: [{
text: 'Upload',
handler: function() {
var form = this.up('form').getForm();
if(form.isValid()){
alert("submit");
form.submit({
url: 'myurl'
waitMsg: 'Uploading file...',
success: function (form,action) {
var data= Ext.JSON.decode(action.response.responseText);
alert("Success: " + data.msg);
Ext.Msg.alert('Success', action.result.message);
},
failure: function (form, action) {
var data = Ext.decode(action.response.responseText);
alert("Failure: " + data.msg);
}
});
}
}
}]
}
我的 url 返回 json 响应,我想在提交成功时处理它。如果有人尝试过,请告诉我