Jquery 如何在列表中保存值以及执行搜索后显示的保存内容?

Jquery 如何在列表中保存值以及执行搜索后显示的保存内容?,jquery,ajax,list,Jquery,Ajax,List,如何在执行搜索后基于结果创建搜索历史记录并能够在searchHistory div中显示它?基本上显示并存储输入到搜索栏中的所有搜索值 <html> <head> <title>Twitter Search</title> <script src="https://code.jquery.com/jquery-1.10.1.min.js"></script> </head> &l

如何在执行搜索后基于结果创建搜索历史记录并能够在searchHistory div中显示它?基本上显示并存储输入到搜索栏中的所有搜索值

 <html>
  <head>
    <title>Twitter Search</title>


    <script src="https://code.jquery.com/jquery-1.10.1.min.js"></script>
  </head>
  <body>
    <h1>Twitter Search</h1>

        <div><label for="search">Search twitter: </label>
        <input type="text" name="search" id="search" /></div>

        <div><input type="button" id="btnSearch" value="Search"></div>
    <div>
        <ul id="resultList">
        </ul>
    </div>
    <div>
        <ul id = "searchHistory">
        </ul>
    </div>
    <script type="text/javascript">

        $(document).ready(function () {

             $("#btnSearch").click(function () {
                $("#resultList").empty();

                $.ajax({
                    data: {
                        q: $("#search").val(),
                        count: 10
                    },
                    url: 'twitter.php/search/tweets.json?q=my%20search&count=10',
                    type: 'GET',
                    dataType: 'json',

                    success: function (serverResponse) {
                        for (var i = 0; i < serverResponse.statuses.length; i++) {
                            var tweet = serverResponse.statuses[i];
                            $("#resultList").append("<li>" + tweet.text + "</li>");
                        }
                    }
                });
            });

        });

    </script>
   </body>
    </html>

推特搜索
推特搜索
搜索推特:
$(文档).ready(函数(){ $(“#BTN搜索”)。单击(函数(){ $(“#结果列表”).empty(); $.ajax({ 数据:{ q:$(“#搜索”).val(), 计数:10 }, url:'twitter.php/search/tweets.json?q=my%20search&count=10', 键入:“GET”, 数据类型:“json”, 成功:函数(serverResponse){ 对于(变量i=0;i”+tweet.text+“”); } } }); }); });
在调用twitter之前,您需要一些缓存数组和数组过滤器函数以及条件来检查数组。这些东西你熟悉吗?这不是一件简单的事情,根据功能要求,我要做的是创建一个jquery函数,用于存储搜索的值和在搜索完成后返回的响应