lapots
lapots

Reputation: 13395

refresh page after switching tab

I've got some tabs with data. How to refresh page when I switch tab? My tabs on the page looks like this

<form>
<ul id="dateTab" class="nav nav-tabs">
    <c:choose>
        <c:when test="${activeTab eq 1}">
            <li id="yd" class="active">
                <a data-toggle="tab" href="#yesterday">Yesterday</a>
            </li>
        </c:when>
        <c:otherwise>
            <li id="yd" class="">
                <a data-toggle="tab" href="#yesterday">Yesterday</a>
            </li>
        </c:otherwise>
    </c:choose>
    ....
</ul>
<div id="dateTabContent" class="tab-content">
    <input type="hidden" id="activeTab" name="activeTab" value="${activeTab}">
    <input type="hidden" id="index" name="index" value="${index + 10}">
        <c:choose>
            <c:when test="${activeTab eq 1}">
                <div class="tab-pane active" id="yesterday">
                    <tb:tableTag data="${ybooks}" id="ytable"/>
                    <button id="moreYbooks" class="btn btn-default" formaction="home.html">More</button>
                </div>
            </c:when>
            <c:otherwise>
                 <div class="tab-pane" id="yesterday">
                    <tb:tableTag data="${ybooks}" id="ytable"/>
                    <button id="moreYbooks" class="btn btn-default" formaction="home.html">More</button>
                </div>
            </c:otherwise>
        </c:choose>
        ....
</div>
</form>

JQuery function looks like this

$(document).ready(
function () {
   $("#dateTab a").click(function(e) {
      e.preventDefault();
      $(this).tab('show');
   });
});

How to refresh page when I click on tab? I should change href?

Upvotes: 1

Views: 3042

Answers (2)

user2886452
user2886452

Reputation:

Do it this way :

var url = window.location;

window.location = url;

Upvotes: 3

Paweł Andruszk&#243;w
Paweł Andruszk&#243;w

Reputation: 8403

use can use location.reload();

Upvotes: 0

Related Questions