当前位置: 代码迷 >> .NET新技术 >> ext.js C# .net解决方案
  详细解决方案

ext.js C# .net解决方案

热度:571   发布时间:2016-04-25 01:23:59.0
ext.js C# .net
页面
 if (CheckListEdit.form.isValid()) {
                        var Rows = Ext.getCmp("grid").getSelectionModel().getSelected();
                        Ext.Ajax.request({
                            url: '/RouteStopRouteHandler/UpdateStart.ashx',
                            method: "POST",
                            params: {
                                ID: Rows.get("ID"),
                                ee: Ext.getCmp('null).getValue(),
                                bb: Ext.getCmp('null').getValue(),
                                cc: Ext.getCmp('null').getValue()
                            },
                            success: function (form, action) {
                                var obj = Ext.decode(form.responseText);
                                if (obj.success == "true") {
                                    Ext.MessageBox.alert('提示', '信息编辑成功!');
                                    CheckListEditWindow.close();
                                    Ext.getCmp("grid").getStore().reload();
                                } else {
                                    Ext.MessageBox.alert('提示', '信息编辑失败!');
                                }
                            },
                            failure: function (form, errorInfo) {
                                Ext.MessageBox.alert('提示', '信息编辑失败!');
                            }
                        });
                    }
C#后台    
    我怎么才能 将  后台的json 格式的   success   返回到页面上呢?
 


------解决思路----------------------
没有“返回”概念,应该是“刷新”界面,而不是返回。
------解决思路----------------------
后台:


context.Response.ClearContent();
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);  //无缓存
context.Response.ContentType = "application/json";
context.Response.Write("{'success': 'true', 'msg': 'update success'}");
context.Response.Flush();
context.Response.End();


如果是form提交的话 为什么不用 form submit?


form.submit({
url: '../data/UpdaterServer.ashx',
method: 'POST',
params: {/*参数列表*/},
success: function(f, action){
if(action.result.success == "true"){
Ext.Msg.alert('提示','提交成功!', function(){
//reload 刷新处理
});
}
else{
Ext.Msg.alert('提示','提交失败!', function(){
//失败处理
});
}
},
failure: function(f, action){
Ext.Msg.alert('提示', '系统错误!', function(){
form.reset();
});
}
});
  相关解决方案