Browse data dynamically

-1

I have a question: I have query in the database made in PHP that returns numbers that are updated with every request I make when accessing the browser. When I give f5, the data is updated and I see them on the screen, up to there blz. But I wanted this data to be updated instantly without having to give f5 in the browser and without using the request every few seconds. I wanted to do this using Jquery for example. I already fucked the net here and I find nothing, just a lot of codes that I do not understand. rsrs

Thank you in advance.

    
asked by anonymous 17.05.2015 / 06:02

1 answer

0

In jQuery it would look something like this:

        function refresh() {
            $.ajax({
                url: "url_da_pagina.php"
            }).done(function (msg) {
                alert(msg);
                //aqui vc trata os dados do resultado
            });
        }

        setInterval(function() { refresh(); }, 3000);
    
18.05.2015 / 00:01