<%@ 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>AJAXJSON的实现</title>
<script language="javascript" type="text/javascript"
src="jquery-1.3.2.js"></script>
<script language=Javascript type="text/javascript">
$(function(){
$("input[type=button]:first").click(
function()
{
$.ajax(
{type:"GET",
http://www.cnblogs.com/sweting/admin/%22Handler2.ashx",
data:"t="+new Date(),
dataType:'text',
success:function(dat){
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.attr("id","ready");//改变绑定好数据的行的id
row.appendTo("#datas");//添加到模板的容器中
}
}
}
);
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table id="datas" border="1" cellspacing="0"
style="border-collapse: collapse">
<tr>
<th style="width: 100px;" align="center">
日期
</th>
<th style="width: 100px;" align="center">
号码
</th>
</tr>
<tr id="row"
style="background: #f00; line-height: 20px; height: 20px; font-size: 12px;">
<td id="riqi"></td>
<td id="haoma"></td>
</tr>
</table>
<input type="button" value="test" />
</div>
</form>
</body>
</html>