<% @ Page Language = "C #" autoeventwireup = "true" codefile = "testeval. aspx. cs" inherits = "testeval" %>
<! 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 runat = "server">
<Title> No title page </title>
<Script language = "JavaScript" type = "text/JavaScript" src = "jquery-1.3.2.js"> </SCRIPT>
<Script language = JavaScript type = "text/JavaScript">
$ (Function (){
$ ("Input [type = button]: Last"). Click (
Function ()
{
$. ajax (
{type: "Get",
http://www.cnblogs.com/sweting/admin/%22Handler2.ashx ",
data:" t = "+ new date (),
datatype: 'text',
ajaxstart: function () {
$ ("# AB" ).html ("ajax starts ............ ");
},
ajaxsend: function () {
$ (" # AB ").html (" the request has been issued ...... ");
},
ajaxsuccess: function () {
$ (" # AB ").html (" asynchronous request succeeded ");
},
error: function () {
$ ("# AB" ).html ("request failed 1");
},
ajaxerror: function () {
$ ("# AB" ).html ("request failed 2");
},
beforesend: function () {
$ ("# AB" ).html ("prepare to load data ...... ");
},
complete: function () {
$ (" # AB ").html (" data loaded ");
},
ajaxcomplete: function () {
$ ("# AB" ).html ("ajax complete! ");
},
ajaxstop: function () {
$ (" # AB ").html (" ajax stops! ");
},
success: function (DAT) {
// $ (" # datas ").html ("");
var da1 = eval ('+ DAT +');
VaR tab = da1.tb;
For (VAR I = 0; I <tab. length; I ++ ){
VaR ROW = $ ("# Row"). Clone ();
Row. Find ("# riqi"). Text (Tab [I]. news_id );
Row. Find ("# haoma"). Text (Tab [I]. news_title );
Row. Find ("# news_type"). Text (Tab [I]. news_type );
Row. Find ("# news_typeid"). Text (Tab [I]. news_typeid );
// Row. ATTR ("ID", "ready"); // change the ID of the row bound to the data
Row. appendto ("# datas"); // Add it to the template container
}
}
}
);
});
});
Function AB ()
{
$. Each ({name: "John", Lang: "JS"}, function (I, n ){
Alert ("item" + I + ":" + n );
If (I = 1)
Return false;
});
}
</SCRIPT>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Input type = "button" value = "EACT" onclick = "AB ();"/>
<Div id = "AB"> </div>
<Table id = "datas" border = "1" cellspacing = "0" style = "border-collapse: collapse">
<Tr>
<TH style = "width: 100px;" align = "center"> date </Th>
<TH style = "width: 100px;" align = "center"> Number </Th>
<TH> type </Th>
<TH> typeid </Th>
</Tr>
<Tr id = "row">
<TD id = "riqi"> </TD>
<TD id = "haoma"> </TD>
<TD id = "news_type"> </TD>
<TD id = "news_typeid"> </TD>
</Tr>
</Table>
<Input type = "button" value = "test"/>
</Div>
</Form>
</Body>
</Html>