php - 如何在codeiginter中删除之前使用confirm
问题描述
$(document).ready(function (){
$('#Delete').on('click', function() {
var no = $('#bill').val();
if(confirm('Are you sure to remove this record ?'))
{
$.ajax({
url: "<?php echo base_url();?>TipUp_Loan/Bill_Delete"+no,
type: 'DELETE',
error: function() {
alert('Something is wrong');
},
success: function(data) {
// $("#"+no).remove();
alert("Record removed successfully");
}
});
}
});
});
这是查看页面代码...
public function Bill_Delete(){
$session_data = $this->session->userdata('logged_in');
$data['username'] = $session_data['username'];
//$Search = $this->input->post('Search1');
$this->User_model->Bill_Delete($_POST["no"]);
}
这个控制器代码............
public function Bill_Delete($no)
{
$this->db->where('billno', $no);
$this->db->delete('salesitem');
$this->db->where('no', $no);
$this->db->delete('salesbill');
echo "Successfully delete";
}
这是型号代码
我的prblm是如何创建确认消息。这只是显示消息,它不会删除到数据库中............
解决方案
您可以通过在按钮标签中添加此 window.confirm 来实现此目的
<button type="submit" class="btn btn-primary" onclick="return confirm('Are you sure want to delete')">Delete<i class="icon-bin position-left"></i></button>
推荐阅读
- node.js - res.sendFile(file) 和 express.static(file) 之间的异常差异
- javascript - 如何延迟 Node/Koa 中的响应?
- ios - 使用带有自定义 url 方案的 IOS 内置 QRCode 扫描仪
- git - 将代码推送到 gitlab 用户名密码对话框打开时,我应该在用户名和密码中输入什么
- python - Flask HTML 转义值
- ios - 如何在 Chrome 上修复 iOS 13 中的旧金山字体?
- python - 用鼠标在python游戏中移动角色的问题
- c - 为什么这个函数在完成递归运行后返回整数 17?
- python - 主要按列投票?
- java - Java - 如何从 Java 中的文件夹中删除文件?