Ext中弹出框的form表单提交和接收返回数据
2015-11-23 18:59
369 查看
今日在编写Ext的弹出框时,碰到需要提交到后台action,然后判断返回的数据。还是跟以前那样直接用
然后去查看了Ext的帮助文档,发现不能这样子用。需要使用以下的方法:
success: function(response, options) { var res=Ext.util.JSON.decode(response.responseText); // 进行判断操作。。。。 }!!! 这样会接收不要返回的response里面的数据,尽管前台的firebug可以查看到正常的响应数据。
然后去查看了Ext的帮助文档,发现不能这样子用。需要使用以下的方法:
buttons : [{ text : '生成', handler : function() { var f = form.getForm(); f.submit({ url : ctx + '/ptree_creatxml', method : 'POST', params : { ptType:Ext.getCmp("ptType").getValue() }, success:function(form,action){ // alert(action.result.type); // var text= form.response.responseText; var obj = action.result; if (obj.success == true) { if (obj.type == "1") { repair.alert("文档名重复,请重新输入文档名"); } else if (obj.type == "0") { repair.alert("添加成功"); win1.hide(); query(); } } else { repair.alert("添加失败"); } }, failure : function(response, options) { repair.alert("生成失败"); }, waitMsg : '正在生成' }); } }]
相关文章推荐
- cwnd类介绍
- liunx下,只获取主机的IP?
- Unity 3d中导入c#脚本时出现 can't add script 如何解决
- 【CODEFORCES】 Educational Codeforces Round 1
- 开锁
- Swift -- swift 函数代码
- 签到
- javascript中的__proto__和prototype 原型链
- spark-yarn
- OpenJudge_P7940 查找最接近的元素
- unity导出android studio工程方法
- 带箭头的提示tips样式
- 幸运数
- Android开发艺术探索学习-IPC之Binder(三)
- debian下mysql安装与配置
- NOIP2015游记——一次开心又失望的旅行
- thinkphp3.1模块分组的建立详细步骤
- 【解决方案】MySQL-5.7.9 服务无法启动-“NET HELPMSG 3534”
- 多态图标(2)-WPF自定义用户控件ImageButton
- 自定义qq空间分享按钮