1

I want to open the same tab when i click submit button, for that i thought that i can make the tab active by calling the tab index but how can i achieve that?

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>

I dont know what to to write in .tabs(???) in the jQuery code. Can some one help me ?

tektiv
  • 14,010
  • 5
  • 61
  • 70
MMR
  • 2,869
  • 13
  • 56
  • 110

1 Answers1

0

How about this in your success callback?

$('#brokerheader').tab('show');
phreakv6
  • 2,135
  • 1
  • 9
  • 11