最近去面试了一家公司,做前端,要求用纯HTML页面,我没有写过,想了解下怎么弄!谁有Jquery实现的纯HTML进行ajax数据绑定的列子吗?分享下啊 ,谢谢了!非常感谢。邮箱[email protected]
解决方案 »
- 求助fileStream方法readbyte
- “隐藏了继承的成员” 如何理解?
- 没有装VS.NET,出现 未能加载类型“test.UI" ;装了VS后,运行正常.请问这是什么原因呀?
- 网页中的标题只让他显示10,其它的都用点来显示
- 怎样才能像论坛回贴一样显示文本和图片?
- 如何防止两个相同的用户从不同的机子同时登陆站点?
- 急!!!asp的一个vbscript程式问题
- 验证控件的问题
- win7系统,用FTP上传刚编译的dll总是上传失败,肿么办呢?
- Selected collating sequence not supported by the operating system.我该怎么办?
- 关于Flash上传文件,超时的问题.
- 关于CKeditor的问题
http://dotnet.aspx.cc/file/jQuery-Ajax-Call-WebService-DataTable.aspx
客户端页面加载完后,再通过js发请求取数据绑定到页面
<!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>jTemplates</title>
</head>
<body>
<div id="result"></div>
<div id="foreachResult"></div>
</body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="http://jtemplates.tpython.com/jquery-jtemplates_uncompressed.js"></script><BR>
<BR><script type="text/template" id="foreach">
<table>
<thead>
<tr>
<td>Index</td>
<td>ID</td>
<td>Name</td>
<td>Age</td>
<td>Mail</td>
</tr>
</thread>
<tbody>
{#foreach $T.table as record begin=1}
<tr>
<td>{$T.record$index}</td>
<td>{$T.record.id}</td>
<td>{$T.record.name}</td>
<td>{$T.record.age}</td>
<td>{$T.record.mail}</td>
</tr>
{#/for}
</tbody>
</table>
</script>
<script>
$(function($) {
var data = {
name: 'User list',
list_id: 6,
table: [
{ id: 1, name: 'Alex', age: 21, mail: '[email protected]' },
{ id: 2, name: 'Amelie', age: 24, mail: '[email protected]' },
{ id: 3, name: 'Polly', age: 18, mail: '[email protected]' },
{ id: 4, name: 'Alice', age: 26, mail: '[email protected]' },
{ id: 5, name: 'Martha', age: 25, mail: '[email protected]' }
]
};
var mydata = { name: "Alex", age: "21" };
$("#result").setTemplate("My name is {$T.name}"); $("#result").processTemplate(mydata);
$('#foreachResult').setTemplate($('#foreach').html()).processTemplate(data);
$('#foreachResult').delegate('td', 'click', function() {
alert($(this).text());
});
});
</script>
</html>