Ajax

Kategorie: JQuery
Erstellt: Donnerstag, 26. April 2012 17:56
Zuletzt aktualisiert: Donnerstag, 26. April 2012 17:56
Geschrieben von Martina Major
script type="text/javascript">
    function update() {
        $("#refresh").load('refresh.php?' + 1*new Date());
    };
   
    function timestamp() {
        $.ajax({
            type: "GET",
            url: "update.php",
            success: function(data){
                $("#timestamp").fadeIn("slow").delay(2000).fadeOut("slow");  
            }
        });
    };
   
    $(document).ready(function() {
        $("#refresh").load("refresh.php");
        var refreshId = setInterval(function() {
            $.ajax({
                type: "GET",
                url: "timestamp.php",
                success: function(data){
                    if (data == 'true'){
                        update();
                    }          
                }
            });
        }, 10000);
    });
</script>