【发布时间】:2018-07-01 03:43:30
【问题描述】:
我创建了自定义弹出窗口来显示我的记录。
我正在使用 CodeIgniter,我正在从数据库中获取记录并显示在正在工作的视图页面上。
现在我在视图页面中有这样的记录
EmpName EMPID Mobile No. Status Action
xyz 122 0012141010 Pending view archive
mnb 123 0124541021 Pending view archive
poiu 124 0000000000 Approved view archive
我正在做的是,当用户点击 " pending" 时,它会要求确认弹出窗口 "Are you sure want to continue?" 如果用户点击 "Later" 按钮,那么弹出窗口将关闭。它不会采取任何行动。到目前为止没有问题。
现在我们来谈谈Sure 按钮。确定按钮不采取任何行动。我不明白为什么它不调用提交操作。即使它在存档上也不起作用。
注意:我不想使用
confirm()或任何alert()弹出窗口
查看页面
<div class="white_bg pad0 m_b_20">
<div class="emp_list">
<div class=" ">
<?php if (!empty($get_emp_records)) {?>
<table cellspacing="0" id="tableData">
<thead>
<tr>
<th class="" width="3%"> <input type="checkbox" id="selectall" />
</th>
<th class="" width="15%"> EmpName </th>
<th class="" width="7%"> EMP ID</th>
<th class="" width="11%"> Mobile No. </th>
<th class="" width="13%"> Status </th>
<th class="" width="23%"> Action </th>
</tr>
</thead>
<?php
foreach ($get_emp_records as $row)
{ $encryption_id=base64_encode($this->encryption->encrypt($row->id));//encrpt the id
?>
<tbody>
<tr>
<td width="3%"><input type="checkbox" name="crm" class="crm_select" value="0" /></td>
<td>
<?php echo $row->firstname; echo $row->lastname;?>
</td>
<td>
<?php echo $row->employee_id;?>
</td>
<td>
<?php echo $row->mobileno;?>
</td>
<?php if ($row->is_approved == 1): ?>
<td><a href="javascript:void(0)" class="table_icon approved">Approved</a></td>
<?php else: ?>
<td>
<a href="javascript:void(0)" class="table_icon pending" onclick="approve(this)" data-id="<?=$row->id;?>"> <span>Pending</span></a>
</td>
<?php endif; ?>
<td><a href="<?php echo site_url('Employee_control/get_employee_view?key='.$encryption_id)?>" class="table_icon view">View</a>
<a href="<?php echo site_url('Employee_control/employee_archive?key='.$encryption_id)?>" class="table_icon archive">Archive</a>
</td>
</tr>
<!--conformation popup-->
<div class="confirmation_alert" id="popup-<?=$row->id;?>" style="display: none;">
<div class="opacity"></div>
<div class="profile_content">
<div class="profile_header clearfix">
<a href="javascript:void(0);" class="close_popup " onclick="closePopup(this)" data-id="<?=$row->id;?>"> x </a>
<div class="profile_name_pic"> Confirmation!!! </div>
<div class="profile_header_right">
</div>
</div>
<div class="profile_body">
<div class="row">
<div class="col-md-12">
<div class="leave_reason">
<h3>Are you sure want to continue?</h3>
</div>
</div>
</div>
</div>
<div class="profile_footer clearfix">
<button type="submit" class="btn_default submit_btn" id="confirm">Sure</button>
<button type="button" class="btn_default edit_btn" onclick="closePopup(this)" data-id="<?=$row->id;?>">Later</button>
</div>
</div>
</div>
</tbody>
<?php } ?>
</table>
<?php }else{echo "No record found";}?>
</div>
</div>
</div>
脚本
var url = "<?php echo base_url();?>";
function approve(obj) {
var id = $(obj).data('id');
$("#popup-" + id).show();
var el = document.getElementById("confirm");
if (el.addEventListener) {
el.addEventListener("click", function() {
//alert("clicked");
window.location = url + "Employee_control/approved_user?key=" + id;
});
}
return false;
}
function closePopup(obj) {
var id = $(obj).data('id');
$("#popup-" + id).hide();
};
【问题讨论】:
-
你必须使用引导模式。
-
@AbdulAhmadMatin,感谢您的回复。还有其他解决方案吗?
-
你必须说我如何使用模态进行配置?
-
@AbdulAhmadMatin,对不起,我找不到你。我没有使用引导模式。我已经创建了自己的风格,我必须在按钮点击时制作一个事件
-
它易于使用的引导模式。您可以创建自己的模式。
标签: javascript php jquery codeigniter codeigniter-3