2016-06-22 43 views
1

我想打开相同的标签,当我点击提交按钮,因为我认为我可以通过调用标签索引使选项卡活动,但我怎么能实现这一目标?如何在点击保存按钮后重定向到相同的标签

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>

我不知道该怎么在.tabs(???)写的jQuery代码。有人能帮我吗 ?

+0

可以使锚链接 http://stackoverflow.com/questions/15678511/opening-tab-with-anchor-link –

+0

可能重复的是:[http://stackoverflow.com/问题/ 33955876 /如何重定向到当前选项卡点击保存在当前选项卡] –

+0

我已经看到所有这些,可以有人编辑我的代码 – MMR

回答

0

如何在您的成功回调?

$('#brokerheader').tab('show'); 
相关问题