Introduction to Ajax:
Ajax, "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML), refers to a web development technology that creates interactive Web applications.
AJAX = Asynchronous JavaScript and XML (a subset of standard generic markup languages).
AJAX is a technique for creating fast-moving web pages.
AJAX enables asynchronous updating of Web pages by making a small amount of data exchange in the background with the server. This means you can update portions of a Web page without reloading the entire page.
Traditional Web pages (without AJAX) if you need to update the content, you must overload the entire page page.
HTML section:
PHP page Section
<?php
$count =$_get["Count"];
$count = $count%7;
Switch ($count) {case
1: $message = "11111111111111111";
Case 2: $message = "22222222222222222";
Case 3: $message = "33333333333333333";
Case 4: $message = "44444444444444444";
Case 5: $message = "55555555555555555";
Case 6: $message = "66666666666666666";
$res = $message;
echo Date ("Y-m-d h:i:s"). "
Effect Chart:
Here's a description of jquery implementation Ajax timed local page refresh
Sometimes, I need some kind of mechanism to keep refreshing the pages to provide a real-time dashboard. If I can only refresh a particular part of the page, it will be great, for example: the traffic lights on the dashboard show the system state.
It is easy to refresh a part of the page by using the jquery JavaScript library only. Once we've incorporated our page into the jquery library, we only need 1 lines of JavaScript to get it working:
So we just put our page into this little JS code snippet to refresh the contents of the ID tag in everything, let's say, every 5 seconds:
SetInterval (function () {
$ ("#content"). Load (location.href+ "#content >*", "");
That's it!! Therefore, it is very easy to complete some real-time monitoring behavior, just that line of code. No more bizarre meta refresh tags or iframe a workaround in the Web application.
Every 5 seconds, we will refresh the same URL and all elements that reside in the Content element ID: content.