【发布时间】:2017-01-19 15:59:53
【问题描述】:
所以我想使用删除按钮删除表格中的一行,然后显示一个模式来确认删除过程。但是,我需要将 ID(在本例中使用文件名)传递给 URL 以完成删除过程。但是,我似乎无法传递完整的 URL 以便在模式中的“是”按钮中删除。我正在尝试模拟这样的过程:Plunker
这是代码。
模态:
<div class="modal-body text-center">
<p> Are you sure you want to remove this from the list? </p><br><br>
<button type="submit" class="btn btn-custom-1">Yes</button>
<button type="button" class="btn btn-custom" data-dismiss="modal">Cancel</button>
</div>
删除按钮:
<button type="button" class="btn btn-custom-3" data-href="<?php echo base_url() . 'admin_forms/delete_carsticker/' . $row->filename; ?>" data-toggle="modal" data-target="#delete-modal"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete </button>
Javascript:
$('#delete-modal').on('show.bs.modal', function(e) {
$(this).find('.btn-custom-1').attr('href', $(e.relatedTarget).data('href'));
});
【问题讨论】:
标签: javascript php jquery twitter-bootstrap codeigniter