Div dinamica + php

Asked

Viewed 443 times

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, someone has some idea?

  • Look for long Polling technique with PHP + AJAX, should help you solve the problem.

  • take a look at this example I created and see if it’s more or less this http://jsfiddle.net/nydoz2mn/

  • Check out this post: http://answall.com/questions/10496/an%C3%A1lise-sobre-c%C3%B3digo-ajax/10507#10507

  • rs, I thought it was a chat system, time line.... if it is, it would be something like: http://jsfiddle.net/r4kofh4h/

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 on Jsfiddle.

  • 3

    The Long Polling technique would be better, take a look at this analysis: http://answall.com/questions/10496/an%C3%A1lise-sobre-c%C3%B3digo-ajax/10507#10507

Browser other questions tagged

You are not signed in. Login or sign up in order to post.