I recently started to listen to the Ajax and Atlas courses provided by Mr Su Peng. In fact, this course has long been available. At that time, I saw the introduction of the first lesson, JavaScript and Dom, so I didn't continue to read it.
The receive.aspxpage is empty, and client.htm calls it.
Receive. aspx. CS
Using System;
Using System. collections;
Using System. componentmodel;
Using System. Data;
Using System. drawing;
Using System. Web;
Using System. Web. sessionstate;
Using System. Web. UI;
Using System. Web. UI. webcontrols;
Using System. Web. UI. htmlcontrols;
Using System. diagnostics;
Public Partial Class Receive: system. Web. UI. Page
{
Protected Void Page_load ( Object Sender, eventargs E)
{
Performancecounter mymemory = New Performancecounter ();
Mymemory. categoryname = " Memory " ;
Mymemory. countername = " Available Kbytes " ;
String Txtresult = " --> Current available memory: " + Mymemory. nextvalue (). tostring () + " KB " ;
Response. Write (datetime. Now. tolongtimestring () + Txtresult );
}
}
Client.htm
<! Doctype HTML public " -// W3C // dtd xhtml 1.0 transitional // en " " Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
< HTML xmlns = " Http://www.w3.org/1999/xhtml " >
< Head >
< Title > No title page </ Title >
< Script Type = " Text/JavaScript " >
VaR XMLHTTP = New Activexobject ( " Microsoft. XMLHTTP " );
Function sendajax ()
{< br> XMLHTTP. open ( " post " , " receive. aspx " , true );
XMLHTTP. send ( null );
XMLHTTP. onreadystatechange = serverprocess;
}
Function serverprocess ()
{
If (XMLHTTP. readystate = 4 | XMLHTTP. readystate = ' Complete ' )
{
Document. getelementbyid ('Namelist'). Innerhtml=XMLHTTP. responsetext;
}
}
Setinterval ( ' Sendajax () ' , 1000 );
</ Script >
</ Head >
< Body >
< Div ID = " Namelist " > </ Div >
</ Body >
</ Html >