- 注册时间
- 2012-9-12
- 最后登录
- 2012-11-23
- 阅读权限
- 10
- 积分
- 76
- 精华
- 0
- 帖子
- 19
|
很简单啊
提交数据
miniui代码- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>{$Think.config.site_name}</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
- <css href="__PUBLIC__/Css/main.css" />
- <js href="__PUBLIC__/Js/boot.js"/>
- </head>
- <body>
- <form id="form1" method="post">
- <input name="department_id" class="mini-hidden" value="{$Dept.dept_id}"/>
- <div style="padding-left:11px;padding-bottom:5px; padding-top: 10px; padding-right: 10px;">
- <table style="table-layout:fixed;" cellspacing="5">
- <tr>
- <td style="width:70px;">部门名称:</td>
- <td style="width:150px;">
- <input name="dept_name" class="mini-textbox" required="true" value="{$Dept.dept_name}"/>
- </td>
- </tr>
- <tr>
- <td >部门描述:</td>
- <td >
- <input name="dept_desc" class="mini-textarea" style="width:350px; height: 80px;" value="{$Dept.dept_desc}"/>
- </td>
- </tr>
- </table>
- </div>
- <div style="text-align:center;padding:10px;">
- <a class="mini-button" onclick="onOk" style="width:60px;margin-right:20px;">确定</a>
- <a class="mini-button" onclick="onCancel" style="width:60px;">取消</a>
- </div>
- </form>
- <script type="text/javascript">
- mini.parse();
- var form = new mini.Form("form1");
- function SaveData() {
- var o = form.getData();
- form.validate();
- if (form.isValid() == false) return;
- $.ajax({
- type:"post",
- url: "__APP__/Department/updateDepartment",
- data: o,
- cache: false,
- success: function (text) {
- CloseWindow("save");
- },
- error: function (jqXHR, textStatus, errorThrown) {
- alert(jqXHR.responseText);
- CloseWindow();
- }
- });
- }
- </script>
- </body>
- </html>
复制代码 Thinkphp代码- public function updateDepartment() {
- if($_REQUEST['department_id']){
- $data['dept_name'] = $_REQUEST['dept_name'];
- $data['dept_desc'] = $_REQUEST['dept_desc'];
- $Depts = D('Dept');
- $vo= $Depts->where('dept_id = ' .$_REQUEST['department_id'])->save($data);
- if($vo){
- $this->ajaxReturn($vo,'部门信息已更新!)',1);
- }else{
- $this->ajaxReturn(0,'部门信息更新失败!',0);
- }
- }
- }
复制代码 |
|