Page refreshes the entire page refresh and local refresh

Source: Internet
Author: User

Entire page Refresh

1. Automatic page refresh: Add the following code to the

   

20 refers to a refresh of the page every 20 seconds.

2. Page Auto-jump: Add the following code to the

   

Where 20 means jump to # page after 20 seconds

3. Page automatically refresh JS version

How jquery implements Div timed refreshes

1 <Head>2 3 <Scriptsrc= "Jquery/jquery-1.4.1.min.js"type= "Text/javascript"></Script>4 5 <Script>6 $ (document). Ready (function () {7 8 SetInterval ("startrequest ()", +);9 //SetInterval This function executes the previous function every 1 seconds according to the 1000 defined laterTen //If you use local refresh, use AJAX technology One }); A  - functionstartrequest () - { the $("#date"). Text (NewDate ()). ToString ()); - } - </Script> -  + </Head>

Ajax Local Refresh

Ajax Local timed Refresh

1 <!DOCTYPE HTML>2 <HTMLLang= "ZH-CN">3 <Head>4 <MetaCharSet= "Utf-8">5 <title>Ajax Auto Local timed Refresh</title>6 <Scripttype= "Text/javascript"src= "Jquery-1.11.2.js"></Script>7 </Head>8 <Body>9 <Script>Ten $ (document). Ready (function(){ One SetInterval ("Change ()", +) A }) - functionChange () { - $.ajax ({ the URL:"demo1.php", - Cache:false, - DataType:"JSON", - Success:function(data) { +  $("#aa"). HTML (data); - } +  }) A  } at  </Script> - <DivID= "AA"></Div> - </Body> - </HTML>

Ajax Local Manual Refresh

1 <!DOCTYPE HTML>2 <HTMLLang= "ZH-CN">3 <Head>4 <MetaCharSet= "Utf-8">5 <title>Ajax Manual Local Refresh</title>6 <Scripttype= "Text/javascript"src= "Jquery-1.11.2.js"></Script>7 </Head>8 <Body>9 <Script>Ten functionChange () { One $.ajax ({ A URL:"demo1.php", - Cache:false, - DataType:"JSON", the Success:function(data) { -  $("#aa"). HTML (data); - } -  }) +  } -  </Script> + <DivID= "AA"></Div> A <Buttononclick= "Change ()">Manual Refresh button</Button> at </Body> - </HTML>

The demo1.php tested are as follows:

1<?PHP2 Header("Content-type:text ml; Charset=utf-8 " );3 4   $oldnum=file_get_contents("C:\111.txt");5   $oldnum=$oldnum+1; 6   file_put_contents("C:\111.txt",$oldnum);7  8   Echo $oldnum;9?>

Page refreshes the entire page refresh and local refresh

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.