From time to time, I need a mechanism to constantly refresh the webpageProvideA Real-time dashboard.If I can only refresh a part of a specific page, it will be very large. For example, the traffic light on the dashboard shows the system status.
It is easy to use the jquery JavaScript library to refresh only part of the page.Once we include the jquery library of our page, we only need one line of JavaScript to get its work:
<SCRIPT src = "/JS/jquery-1.3.2.min.js" type = "text/JavaScript"> </SCRIPT>
So we only need to put our page into this small JSCodeRefresh the Content ID tag in the fragment. Let's say every 5 seconds:
Setinterval (function () {$ ("# Content"). Load (location. href + "# content> *", "") ;}, 5000 );
This is it !!Therefore, it is easy to complete some real-time monitoring behaviors, just that line of code.There is no more strange metadata refresh tag or IFRAME solution in Web ApplicationsProgram.
Every 5 seconds, we will refresh the URL with the same content and all elements, resident in the content where the element ID is the content element: content.