i want to refresh a div without layout page only 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? 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.