title: How to set active tab after fetching the view from an ajax call?
body: <p>I am trying to set <code>active tab</code> for <code>bootstrap 3</code> tabs after fetching the view from an ajax call but Its not working.</p>
  
  <p><strong>The view is something like this:</strong></p>
  
  <pre><code>&lt;div class="portlet light "&gt;
      &lt;div class="portlet-title tabbable-line"&gt;
          &lt;div class="caption"&gt;
              &lt;i class="icon-globe font-dark hide"&gt;&lt;/i&gt;
              &lt;span class="caption-subject font-dark bold uppercase"&gt;TODAY&lt;/span&gt;
          &lt;/div&gt;
          &lt;ul id="tab" class="nav nav-tabs"&gt;
              &lt;li class="active"&gt;
                  &lt;a href="#tab_1_1" class="active" data-toggle="tab"&gt; Collections &lt;/a&gt;
              &lt;/li&gt;
              &lt;li&gt;
                  &lt;a href="#tab_1_2" data-toggle="tab"&gt; Activities &lt;/a&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
      &lt;div class="portlet-body"&gt;
          &lt;!--BEGIN TABS--&gt;
          &lt;div class="tab-content"&gt;
              &lt;div class="tab-pane active" id="tab_1_1"&gt;
  </code></pre>
  
  <p><strong>And here is the script:</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function load_page() 
  {
  
  
      $.ajax(
          {
          url: 'notification_table/',
          type: 'GET',
          dataType: 'html',
          }).done(
                  function(data)
                  {
                  $('#home_view').html(data);
                  }
                  );
  
      $('.nav-tabs a[href="#tab_1_2"]').tab('show');
  }
  
   window.onload = function () 
   {
      load_page();
      setInterval(function () {
      load_page(); }, 5000);
   }
  &lt;/script&gt;
  </code></pre>
  
  <p>As you can see that I tried doing <code>$('.nav-tabs a[href="#tab_1_2"]').tab('show');</code> and I also tried <code>$('#tab a[href="#tab_1_2"]').tab('show');</code> but both are not working.</p>
  
  <p><em>What am I doing wrong here?</em></p>