我将这些内容放在一个使用ajax请求加载的html文件中。当页面刷新时。如果用户在特定标签中说main2 - > sub2,加载内容后我想显示相同的main2-> sub2标签而不是main1-> sub1标签
使用main.html 中的单独按钮触发 刷新
main.html中 tabs.html tabs.html将由ajax请求返回。我希望在内容刷新之后保留内部和外部选项卡中的选项卡,该选项卡在刷新之前显示。<a onclick="data_reload_refresh()"><button type="button" class="btn btn-success" id="refresh_button" style="float:right;background-color:#6D6A66;border-color:#312D25;"> Refresh</button> </a>
<#include "./tabs.html">
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-6" style="width: 100%; margin-left: -18px;">
<div class="panel with-nav-tabs panel-primary">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li class="active"><a href="#tabone" data-toggle="tab">Main 1</a></li>
<li><a href="#tabtwo" data-toggle="tab"> Main 2</a></li>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade in active" id="tabone">
<div class="row">
<div class="col-md-6" style="width: 100%">
<div class="panel with-nav-tabs panel-info">
<div class="panel-heading">
<ul class="nav nav-tabs" style="color: red;">
<li><a href="#tabsub1" data-toggle="tab">sub 1</a></li>
<li><a href="#tabsub2" data-toggle="tab">sub 2</a></li>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade in active" id="tabsub1">1st Tab Sub 1</div>
<div class="tab-pane fade " id="tabsub2">1st Tab Sub 2</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade " id="tabtwo">
<div class="row">
<div class="col-md-6" style="width: 100%">
<div class="panel with-nav-tabs panel-info">
<div class="panel-heading">
<ul class="nav nav-tabs" style="color: red;">
<li><a href="#tabsub11" data-toggle="tab">sub 1</a></li>
<li><a href="#tabsub22" data-toggle="tab">sub 2</a></li>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade in active" id="tabsub11">2nd Tab Sub 1</div>
<div class="tab-pane fade " id="tabsub22">2nd Tab Sub 2</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>