2015-04-03 130 views
1

當我點擊「工具」選項卡,發生什麼發生:標籤不切換,而不是切換。看起來你的文章主要是代碼;請添加更多的細節。引導AJAX選項卡不工作

$('[data-toggle="tab"]').click(function(e) { 
 
\t var $this = $(this), 
 
\t \t loadurl = $this.attr('href'); 
 

 
\t $.get(loadurl, function(data) { 
 
\t \t $('#content').html(data); 
 
\t }); 
 

 
\t $this.tab('show'); 
 
\t return false; 
 
});
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet"/> 
 
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/js/bootstrap.min.js"></script> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
    <div class="container"> 
 
     <ul class="nav nav-tabs nav-justified" role="tablist"> 
 
     <li role="navigation" class="active"><a href="/engine/ajax/main.php" aria-controls="main" role="tab" data-toggle="tab">My links</a></li> 
 
     <li role="navigation"><a href="#tools" aria-controls="stat" role="tab" data-toggle="tab">Statistics</a></li> 
 
     <li role="navigation"><a href="/engine/ajax/tools.php" aria-controls="tools" role="tab" data-toggle="tab">Tools</a></li> 
 
     <li role="navigation"><a href="#payments" aria-controls="payments" role="tab" data-toggle="tab">Payments</a></li> 
 
     </ul> 
 
    </div> 
 

 
    <div id="content" class="container"> 
 

 
    </div>
我哪裏錯了?

+0

我按照這個教程來做:http://jsfiddle.net/adrienne/La2765jn/ – bars96 2015-04-03 16:52:20

回答

0

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/js/bootstrap.min.js"></script>

這樣前:

<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/js/bootstrap.min.js"></script>

bootstrap.min.js需要jquery.min.jsŧ o在它之前先跑。

相關問題