Bootstrap崩溃工作正常,但当部分视图加载到同一视图时,就是问题开始的地方。
如果我点击按钮折叠div,它只会闪烁但不会崩溃。
以下是观点:
$(document).ready(function () {
$('#dropdownmenu').change(function(){
$("#myForm").submit();
});
})
然后这是在点击按钮上加载局部视图的javascript:
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>Dashboard</h1><small><button class="btn btn-xs btn-success" data-toggle="collapse" data-target="#collapsible">Toggle</button></small>
</section>
<!-- Main content -->
<section class="content">
<!-- Small boxes (Stat box) -->
<div class="row">
<div class="collapse" id="collapsible">
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
<h3>150</h3>
<p>New Orders</p>
</div>
<div class="icon">
<i class="ion ion-bag"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div><!-- ./col -->
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-green">
<div class="inner">
<h3>53<sup style="font-size: 20px">%</sup></h3>
<p>Bounce Rate</p>
</div>
<div class="icon">
<i class="ion ion-stats-bars"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div><!-- ./col -->
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-yellow">
<div class="inner">
<h3>44</h3>
<p>User Registrations</p>
</div>
<div class="icon">
<i class="ion ion-person-add"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div><!-- ./col -->
<div class="col-lg-3 col-xs-6">
<!-- small box -->
<div class="small-box bg-red">
<div class="inner">
<h3>65</h3>
<p>Unique Visitors</p>
</div>
<div class="icon">
<i class="ion ion-pie-graph"></i>
</div>
<a href="#" class="small-box-footer">More info **strong text**<i class="fa fa-arrow-circle-right"></i></a>
</div>
</div><!-- ./col -->
</div>
</div><!-- /.row -->
<!-- Main row -->
<div class="row">
<!-- Left col -->
<section id="Results" class="col-lg-12">*This is where the partial view loads.</section>
</div>
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
答案 0 :(得分:0)
您的javascript是在客户端执行的,我相信它不会将@Html.Raw(Url.Action("Results","Dashboard"))
转换为HTML。您的ASP.NET必须将其转换为HTML。它按原样输出字符串@Html.Raw()
。尝试使用浏览器工具在运行时检查DOM元素。
请确保您转义双引号(“)字符,例如@Html.Raw(Url.Action(\"Results\",\"Dashboard\"))
,否则您的javascript将无效。
尝试类似这样的事情
<script>
document.getElementById("showresults").onclick = function () { ViewResults() };
function ViewResults() {
$("#Results").load("<div>This is just test</div>");
}
看到它有效。
答案 1 :(得分:0)
试试这个
$(&#34;#结果&#34)的负载。(&#39; Url.Action(&#34;结果&#34;&#34;信息中心&#34)&#39);