Reputation: 13844
I am using bootsrap tab.I have actually three sections.By default section one is selected.Suppose if I move to section 2 then data of section 2 should be refreshed. Actually I have registration form in section 1 and in section 2 to view the resgitered users.So suppose i entered some details in section 1 then it is inserted into database.Now unless I refresh the section 2,I wont get new values from DB.Please tell me how to refresh.Alternate solutions are also welcome
<div class="tabbable" id="myTabs">
<ul class="nav nav-tabs">
<li><a id="tabAll">All</a></li>
<li class="active"><a href="#tab1" data-toggle="tab">Section 1</a></li>
<li><a href="#tab2" data-toggle="tab">Section 2</a></li>
<li><a href="#tab3" data-toggle="tab">Section 3</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<p>I'm in Section 1.</p>
</div>
<div class="tab-pane" id="tab2">
<p>Howdy, I'm in Section 2.</p>
</div>
<div class="tab-pane" id="tab3">
<p>Howdy, I'm in Section 3.</p>
</div>
</div>
</div>
<script>
$('#tabAll').click(function(){
$('#tabAll').addClass('active');
$('.tab-pane').each(function(i,t){
$('#myTabs li').removeClass('active');
$(this).addClass('active');
});
});
</script>
Upvotes: 1
Views: 2894
Reputation: 8781
When you click on section 2 tab make an ajax call to your DB in order to fetch new values. Another option is to do the refresh after you submit your form (I assume that you also do it using ajax) simply load a new content to "#tab2" div in ajax success handler of your form submission event
Upvotes: 1
Reputation: 40639
Upvotes: 1