如何在codeiginiter中显示弹出的jquery表单编辑

时间:2016-09-07 07:31:25

标签: php jquery codeigniter codeigniter-3

我是Codeigniter的新手,当我点击编辑按钮时出现问题,表单编辑无法弹出。我不知道如何模态popup以便它可以正常工作。如何配置控制器?

我的控制器

public function edit()
{
    $id=$this->uri->segment(3);
    $this->load->model('m_activity');
    $data['data']=$this->m_activity->per_id($id);

}

我的模特

function per_id($id)
{
    $this->db->where('activity_detail_id',$id);
    $query=$this->db->get('t_trx_activity_detail');
    return $query->result();
}

我的观点

<a href='<?php echo site_url();?>activity/edit/<?php echo 
                                        $row->activity_detail_id;?>'class="btn btn-outline btn-circle btn-sm purple" data-toggle="modal" >
                            <i class="fa fa-edit"></i> Edit </a> |

<div class="modal fade left" id="edit"> 

1 个答案:

答案 0 :(得分:0)

那里有很多jquery库。其中一个是Jquery UI。您可以使用其对话框。

Reference

EX:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Dialog - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#dialog" ).dialog();
  } );
  </script>
</head>
<body>

<div id="dialog" title="Basic dialog">
  <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>


</body>
</html>