• 无刷新分页技术


     <script src="script/jquery-1.6.1.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            var index = 0;
            $(document).ready(function () {
                $.post("Default5.aspx", { name: index }, function (msg) {
                 
                    $("tr:gt(0)").remove();
                    var artice = msg;

                    for (var i = 0; i < 5; i++) {
                   
                        $("table").append("<tr><td>" + artice[i]["ID"] + "</td><td>" + artice[i]["Writer"] + "</td><td>" + artice[i]["Title"] + "</td></tr>");
                    
                    }
                }, "json");
            });
            $(document).ready(function () {
                $("a").click(function () {
                    if ($(this).html() == "下一页") {
                        index = index + 5;
                        if (index > 10) {
                            index = 10;
                        }
                    }
                    if ($(this).html() == "上一页") {
                        index = index - 5;
                        if (index < 0) {
                            index = 0;
                        }
                    }
                 //   alert(index);
                    $.post("Default5.aspx", { name: index }, function (msg) {
                     //   alert(msg[0]["ID"]);

                        $("tr:gt(0)").remove();
                        var artice = msg;

                        for (var i = 0; i < 5; i++) {
                            // alert("11");
                            $("table").append("<tr><td>" + artice[i]["ID"] + "</td><td>" + artice[i]["Writer"] + "</td><td>" + artice[i]["Title"] + "</td></tr>");
                            // $("table").append("<tr><td>1</td><td>2</td><td>3</td></tr>");
                        }
                    }, "json");
                });
            });
        </script>
  • 相关阅读:
    Django中的分页操作、form校验工具
    Django之form表单操作
    手写版本orm
    mysql注入问题
    MySQL基本操作
    初识数据库
    进程池、线程池
    信号量
    event事件
    死锁
  • 原文地址:https://www.cnblogs.com/bjjjunjie/p/2077990.html
Copyright © 2020-2023  润新知