在我的主页(下面包含引导程序确认脚本)中,有一些选项卡,用于按ajax GET
方法加载内容。
<div class="portlet-body">
<div class="tab-content" id="tab_content">
<div class="tab-pane active"
id="tab_open"
data-refreshurl="noticelist.php?status=0"></div>
<div class="tab-pane"
id="tab_done"
data-refreshurl="noticelist.php?status=1"></div>
<div class="tab-pane"
id="tab_canceled"
data-refreshurl="noticelist.php?status=2"></div>
</div>
</div>
加载选项卡内容的脚本:
$("#tab_open").load("noticelist.php?status=0", function (result) {
App.blockUI({target: "#tab_content",animate: true});
$("#tab_open").tab("show");
App.unblockUI("#tab_content");
});
$(\'[data-toggle="tabajax"]\').click(function(e) {
App.blockUI({target: "#tab_content",animate: true});
var $this = $(this),
loadurl = $this.attr("href"),
targ = $this.attr("data-target");
$.get(loadurl, function(data) {
$(targ).html(data);
});
$this.tab("show");
App.unblockUI("#tab_content");
return false;
});
每个选项卡内都有带有引导程序确认的此链接:
<a class="btn btn-icon-only red-mint deleteit" id="delete_'.$val['DS'].'"
data-toggle="confirmation"
data-popout="true"
data-btn-ok-label="'.T::ACTIONS_3.'"
data-btn-cancel-label="'.T::ACTIONS_4.'"
data-original-title=""
data-on-confirm="shortwork"
data-job-id="del"
data-id="'.$val['DS'].'"
title="'.T::SYSMSG_0.'"
href="#"
><i class="icon-trash"></i></a>
当我单击按钮时,什么也没有发生,并且错误控制台为空。我不确定出什么事了吗?
如果将按钮直接添加到主页中,确认将正确显示,为什么它在ajax加载内容方法中不起作用?
给定内容,将此代码添加到php文件中即可解决该问题。
$('[data-toggle=confirmation]').confirmation({ btnOkClass: 'btn btn-sm btn-success', btnCancelClass: 'btn btn-sm btn-danger'});
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句