Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/477.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jqueryajax中的slideDown传入数据_Javascript_Jquery_Asp.net_Ajax - Fatal编程技术网

Javascript jqueryajax中的slideDown传入数据

Javascript jqueryajax中的slideDown传入数据,javascript,jquery,asp.net,ajax,Javascript,Jquery,Asp.net,Ajax,我是jQueryAjax新手,所以如果问题太明显,我很抱歉 我在ASP.NET中有两个webforms,一个是将数据添加到数据库中,另一个是以ul li格式显示数据 到目前为止,我只成功使用了基本的jQueryAjax,只要有新数据,就会显示出来 我希望无论何时添加新数据,都必须以slideDown格式向用户显示 注意:我没有任何答案。下面的答案没有帮助。 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"&g

我是jQueryAjax新手,所以如果问题太明显,我很抱歉

我在ASP.NET中有两个webforms,一个是将数据添加到数据库中,另一个是以ul li格式显示数据

到目前为止,我只成功使用了基本的jQueryAjax,只要有新数据,就会显示出来

我希望无论何时添加新数据,都必须以slideDown格式向用户显示

注意:我没有任何答案。下面的答案没有帮助。

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script>
        $(document).ready(function () {
            $.ajax({
                url: 'WebForm1.aspx',
                success: function (data) {
                    $("#Urunler").html("<li>" + data + "</li>");
                }
            });
        });
    </script>
    <style>
        td
        {
            width: 200px;
            height: 30px;
            background: yellow;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>


        <ul id="Urunler" runat="server">

        </ul>


    </div>
    </form>
</body>
</html>

$(文档).ready(函数(){
$.ajax({
url:'WebForm1.aspx',
成功:功能(数据){
$(“#Urunler”).html(“
  • ”+data+“
  • ”); } }); }); 运输署 { 宽度:200px; 高度:30px; 背景:黄色; }
    多谢各位

    您可以执行以下操作:

    $("#Urunler").hide().html("<li>" + data + "</li>").slideDown();
    
    $(“#Urunler”).hide().html(“
  • ”+data+“
  • ”).slideDown();

    由于您的AJAX是页面加载的,您可以通过CSS从UL hidden开始,并删除该
    .hide()
    ,无论是哪种方式。

    或者为了获得更奇特的效果,将
    .hide()
    替换为
    .slideUp()
    @sidneylebrand——考虑一下,但是如果UL在开始时为空,则不会有太大区别。确实如此,然而,OP在每次提交表单后都会需要它。为什么每一秒,这没有多大意义?AJAX调用只会运行一次。