2016-06-22 75 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'); 
相關問題