最近去面试了一家公司,做前端,要求用纯HTML页面,我没有写过,想了解下怎么弄!谁有Jquery实现的纯HTML进行ajax数据绑定的列子吗?分享下啊 ,谢谢了!非常感谢。邮箱[email protected]

解决方案 »

  1.   

    参见
    http://dotnet.aspx.cc/file/jQuery-Ajax-Call-WebService-DataTable.aspx
      

  2.   

    前后端还是要配合使用的,就像你现在的这个问题,你的前提还是要知道你的后台返回什么的数据,“纯文本,json,xml,拼接的html”,这样你再callback这个函数中,才好有具体的操作
      

  3.   

    其实,对纯HTML还是不是很理解,有什么区别嘛
      

  4.   

    纯HTML,不是用服务器控件,用input的,在后台怎么操作得到数据呀,能给个例子么,简单易懂的,比如一个用户注册,我是初学者
      

  5.   

    呈现页面时服务器端不需要任何处理,iis直接返回静态页面
    客户端页面加载完后,再通过js发请求取数据绑定到页面
      

  6.   

    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><?xml version="1.0" encoding="UTF-8" ?>  
    <!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>