Как сделать обновление части страницы?

Discussion in 'PHP' started by ttt0z, 1 Aug 2010.

  1. Winst0n

    Winst0n Elder - Старейшина

    Joined:
    19 Aug 2008
    Messages:
    92
    Likes Received:
    5
    Reputations:
    0
    ttt0z,

    Stat.html:
    Code:
    <html>   
    <head>   
    <meta http-equiv="Content-Type" content="text/html; Charset=UTF-8">   
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    </head>   
      
    <body>   
           Статистика: </br>
        <div id="content"></div>   
           
        <script>   
            function show()   
            {   
                $.ajax({   
                    url: "stat.php",   
                    cache: false,   
                    success: function(html){   
                        $("#content").html(html);   
                    }   
                });   
            }   
           
            $(document).ready(function(){   
                show();   
                setInterval('show()',1000);   
            });   
        </script>   
           
    </body>   
    </html> 
    stat.php:
    PHP:
    <?
    $a=rand(1,90);
    echo 
    $a;
    ?>
     
    #21 Winst0n, 5 Aug 2010
    Last edited: 5 Aug 2010