How to update a DIV with PHP

1
Hello, I have read some tutorials on how to update every few seconds (using javascript, jquery, etc.) and was wondering if there is a way to update a DIV with PHP itself , when you press a button for example.

For example, when doing a search update a specific DIV within the site without updating the entire page.

    
asked by anonymous 08.05.2015 / 17:30

3 answers

1
$('#botao').click(function(){ 
    $.ajax({
            type      : 'post', 
            url       : 'teste.php', 
            data      : 'nome='+ $('#campo1').val() +'&sobrenome='+ $('#campo2').val(), 
            dataType  : 'html', 
            success : function(resultado){
                    $('#tabela').html(resultado);
                }
        }); 
});
    
08.05.2015 / 19:48
0

Not possible, for this you need a client-side language like javascript. If you use only PHP you can build the updated page and send it back to the client again.

    
08.05.2015 / 19:17
0

AJAX + jQuery

Function load()

With PHP, it is not possible to use a language that works on the server.

    
08.05.2015 / 19:30