[英]Refresh div without layout
i want to refresh a div without layout page only div. 我想刷新一个没有布局页面的div div。 The problem is layout doesnt refresh but i cant access the other tabs because all of page is refreshing.So how can i refresh only div=IsEmri?
问题是布局无法刷新,但由于所有页面都在刷新,所以我无法访问其他选项卡。那么我怎么只刷新div = IsEmri? Thanks a lot.
非常感谢。 Here is the code:
这是代码:
<script src="~/js/jquery_1.9.0.min.js"></script> <script type="text/javascript"> var url = location.pathname=$('#IsEmri').replace(/&?_layout=([^&]$|[^&]*)/i, ""); //$(document).ready(function () { // $('#IsEmri').load(url); //}); function refresh() { setTimeout(function () { $('#IsEmri').fadeOut('slow').load(url).fadeIn('slow'); refresh(); }, 5000); } </script>
<link href="~/lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet" /> <div class="row col-md-12" id="IsEmri"> @foreach (var item in Model.IsEmirleri) { <div class="col-md-4"> <table class="table table-bordered table-hover table-sm col-4"> <tbody> <tr> <td> @await Component.InvokeAsync("IsEmri", item)</td> </tr> </tbody> </table> </div> }
<script type="text/javascript">
var url = location.pathname=$('#IsEmri').replace(/&?_layout=([^&]$|[^&]*)/i, "");
$(document).ready(function () {
setTimeout(function() {
$('#IsEmri').hide();
refresh();
}, 5000)
});
function refresh() {
$('#IsEmri').show().fadeOut('slow').load(url).fadeIn('slow');
}
</script>
Wait for your DOM to be ready, when it is, initiate a timer which calls the setInterval after a specified period again and again. 等待DOM准备就绪,然后启动一个计时器,该计时器在指定的时间段后一次又一次调用setInterval。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.