gpt4 book ai didi

javascript - 单击“保存”按钮后如何重定向到同一选项卡

转载 作者:行者123 更新时间:2023-11-28 05:52:41 24 4
gpt4 key购买 nike

我想在单击提交按钮时打开同一个选项卡,因为我认为我可以通过调用选项卡索引来使选项卡处于事件状态,但我怎样才能实现这一点?

function updatebroker() {
var result = $("#broker_form").serialize();
$.ajax({
type: 'POST',
url: site_url + "mycontacts/updatebroker",
data: result,
success: function(response) {
$('.insertmessage').attr('class', '').addClass('text-success').html('Updated successfully.').show();
window.location.href = site_url + 'mycontacts/getcommonlist';
setTimeout(function() {
$(".insertmessage").hide();
window.location.href = site_url + 'mycontacts/getcommonlist';
$("#tabs").tabs(/* ? ? ? ? ? ? ? ? ? ? ? ? ? */);

}, 3000);

}
});
}
<!-- Added via Snippet -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<ul>
<li id="client">
<a data-toggle="tab" href="#commonclientlist">My Clients</a>
</li>
<li>
<a data-toggle="tab" href="#developers">Developers</a>
</li>
<li id="brokerheader">
<a data-toggle="tab" href="#brokers">Brokers</a>
</li>
<li>
<a data-toggle="tab" href="#serviceproviders">My Service Providers</a>
</li>
</ul>
<div class="tab-content">
<div id="commonclientlist" class="tab-pane fade ">
<?php include APPPATH . 'views/client/list_clients.php'; ?>
</div>
<div id="developers" class="tab-pane fade">
<?php include APPPATH . 'views/mycontacts/developerslist.php'; ?>
</div>
<div id="brokers" class="tab-pane fade">
<?php include APPPATH . 'views/mycontacts/brokerslist.php'; ?>
</div>
<div id="serviceproviders" class="tab-pane fade">
<?php include APPPATH . 'views/service/listserviceprovider.php'; ?>
</div>
</div>

我不知道在 jQuery 代码中的 .tabs(???) 中要写什么。有人可以帮助我吗?

最佳答案

在你的成功回调中这个怎么样?

$('#brokerheader').tab('show');

关于javascript - 单击“保存”按钮后如何重定向到同一选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37960152/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com