dynamic div + php

1

I need a table that is updated every instant automatically, like the facebook timeline that updates itself.

I think in jquery you can do this, does anyone have any ideas?

    
asked by anonymous 22.08.2014 / 14:24

1 answer

2

Yes it is possible to do with jquery and javascript, as in the example below:

jquery:

var req = 0;

$(document).ready(function () {
    update();
});

function update() {
    req++;
    $.ajax({
        type: "POST",
        url: '/echo/html/',
        data: {
            html: 'Requisição: ' + req,
            delay: 0
        },
        success: function (data) {
            $('div').html(data);
        }
    });
}

setInterval(function () {
    update();
}, 3000);

See working in JSFiddle .

    
22.08.2014 / 15:16