Ext.Ajax.request 与FormPanel.form.submit
代码
Ext.Ajax.request({
url : 'url',
params : {
ID : record.data.ID
},
success : function(response, options) {
var txt=Ext.util.JSON.decode(response.responseText);
if(txt.success)
{
Ext.Msg.show({
title : '成功提示',
msg : '删除成功!',
buttons : Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
Project_grid.getStore().remove(record);
}
else
{
Ext.Msg.show({
title : '错误提示',
msg : txt.msg,
buttons : Ext.Msg.OK,
icon : Ext.Msg.ERROR
});
}
},
failure : function() {
Ext.Msg.show({
title : '错误提示',
msg : '删除时发生错误!',
buttons : Ext.Msg.OK,
icon : Ext.Msg.ERROR
});
}
});
Ext.Ajax.request({
url : 'url',
params : {
ID : record.data.ID
},
success : function(response, options) {
var txt=Ext.util.JSON.decode(response.responseText);
if(txt.success)
{
Ext.Msg.show({
title : '成功提示',
msg : '删除成功!',
buttons : Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
Project_grid.getStore().remove(record);
}
else
{
Ext.Msg.show({
title : '错误提示',
msg : txt.msg,
buttons : Ext.Msg.OK,
icon : Ext.Msg.ERROR
});
}
},
failure : function() {
Ext.Msg.show({
title : '错误提示',
msg : '删除时发生错误!',
buttons : Ext.Msg.OK,
icon : Ext.Msg.ERROR
});
}
});
2、关于 Ext.FormPanel
可以通过FormPanel.form.submit来提交到服务器,然后再通过传回来的值来处理接下来的工作。
Js代码
form.submit
//提交到服务器
PformPanel.form.submit
(
{
url:url, //提交的页面路径
method:'post',//提交方式为post
//提交成功的回调函数
success:function(form,action)
{
var flage = action.result.success;
//如果服务器端传过来的数据为true则表示添加成功
if (flage == true)
{
Ext.MessageBox.alert('恭喜','添加添加成功!');
newWin.hide();
}
},
//提交失败的回调函数
failure:function()
{
Ext.Msg.alert('错误','服务器出现错误请稍后再试!');
}
}
);
url : 'url',
params : {
ID : record.data.ID
},
success : function(response, options) {
var txt=Ext.util.JSON.decode(response.responseText);
if(txt.success)
{
Ext.Msg.show({
title : '成功提示',
msg : '删除成功!',
buttons : Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
Project_grid.getStore().remove(record);
}
else
{
Ext.Msg.show({
title : '错误提示',
msg : txt.msg,
buttons : Ext.Msg.OK,
icon : Ext.Msg.ERROR
});
}
},
failure : function() {
Ext.Msg.show({
title : '错误提示',
msg : '删除时发生错误!',
buttons : Ext.Msg.OK,
icon : Ext.Msg.ERROR
});
}
});
Ext.Ajax.request({
url : 'url',
params : {
ID : record.data.ID
},
success : function(response, options) {
var txt=Ext.util.JSON.decode(response.responseText);
if(txt.success)
{
Ext.Msg.show({
title : '成功提示',
msg : '删除成功!',
buttons : Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
Project_grid.getStore().remove(record);
}
else
{
Ext.Msg.show({
title : '错误提示',
msg : txt.msg,
buttons : Ext.Msg.OK,
icon : Ext.Msg.ERROR
});
}
},
failure : function() {
Ext.Msg.show({
title : '错误提示',
msg : '删除时发生错误!',
buttons : Ext.Msg.OK,
icon : Ext.Msg.ERROR
});
}
});
2、关于 Ext.FormPanel
可以通过FormPanel.form.submit来提交到服务器,然后再通过传回来的值来处理接下来的工作。
Js代码
form.submit
//提交到服务器
PformPanel.form.submit
(
{
url:url, //提交的页面路径
method:'post',//提交方式为post
//提交成功的回调函数
success:function(form,action)
{
var flage = action.result.success;
//如果服务器端传过来的数据为true则表示添加成功
if (flage == true)
{
Ext.MessageBox.alert('恭喜','添加添加成功!');
newWin.hide();
}
},
//提交失败的回调函数
failure:function()
{
Ext.Msg.alert('错误','服务器出现错误请稍后再试!');
}
}
);
keim,毕业于安徽科技学院理学院,2003年开始对Web开发有浓厚的兴趣,并专注于C#/java Web开发,软件架构设计、分布式相关、项目管理、前端设计等等,实战派...