Finally, it's a good time.
An example of Ajax partial Refresh:
Front-end page:
<% @ Language = "VBScript" codePage = "65001" %>
<! 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>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> Ajax partial refresh </title>
<SCRIPT type = "text/JavaScript">
<! --
// Create an XMLHTTPRequest object
VaR XMLHTTP;
Try {
XMLHTTP = new activexobject ('msxml2. xmlhttp ');
} Catch (e ){
Try {
XMLHTTP = new activexobject ('Microsoft. xmlhttp ');
} Catch (e ){
Try {
XMLHTTP = new XMLHttpRequest ();
} Catch (e ){}
}
}
Function getpart (URL ){
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = function (){
If (XMLHTTP. readystate = 4)
{
If (XMLHTTP. Status = 200)
{
If (XMLHTTP. responsetext! = ""){
Document. getelementbyid ("partdiv"). innerhtml = Unescape (XMLHTTP. responsetext );
}
}
Else {
Document. getelementbyid ("partdiv"). innerhtml = "data loading error ";
}
}
}
XMLHTTP. setRequestHeader ("If-modified-since", "0 ");
XMLHTTP. Send (null );
}
Setinterval ("getpart ('getpart. asp ')", 1000)
// -->
</SCRIPT>
</Head>
<Body>
<Div id = "partdiv"> </div> <! -- Partial data refresh container -->
</Body>
</Html>
Background page: [getpart. asp]
<% @ Language = "VBScript" codePage = "65001" %>
<! -- # Include file = "conn. asp" -->
<%
Dim rs
Dim SQL
Set rs = server. Createobject ("ADODB. recordset ")
SQL = "select * From king_test"
Rs. Open SQL, Conn, 1, 1
If not (Rs. bof and Rs. EOF) then
Response. Write ("<Table> ")
Response. Write (escape ("<tr> <TD> id </TD> <TD> keyword </TD> </tr> "))
Do while not Rs. EOF
%>
<Tr> <TD> <% response. write (RS ("ID") %> </TD> <% response. write (escape (RS ("keyword") %> </TD> </tr>
<%
Rs. movenext
Loop
Response. Write ("</table> ")
End if
Rs. Close
Set rs = nothing
Conn. Close
Set conn = nothing
%>