3
I have a system where he picks up information from the database. And this database is getting data directly, so I wanted to know how I took this data and show it on the page, but without this page being updated.
This system is in php.
3
I have a system where he picks up information from the database. And this database is getting data directly, so I wanted to know how I took this data and show it on the page, but without this page being updated.
This system is in php.
4
You will need ajax for this, follow a minimalist example:
$.ajax({
url:'minha_pagina_acesso_banco.php', //sua página em php que retornará os dados
type:'POST', // método post, GET ...
data: 'param=1¶m2=2', //seus paramêtros
success: function(data){ // sucesso de retorno executar função
$('#result').html(data); // adiciona o resultado na div #result
}
});
You can perform this function as per user action, in a time interval, when loading the page and etc.
For more information on the use of jQuery.ajax()
0
I recommend using GET in Jquery.
$.get("minha_pagina_acesso_banco.php",
function(data){
$('#result').html(data);
});
As you can see the code gets smaller, you can send and receive data like this.
same syntax for post, if you want to send forms, only the method is changed.
$.post("minha_pagina_acesso_banco.php",
function(data){
$('#result').html(data);
});
Check in
http://api.jquery.com/jquery.post/
http://api.jquery.com/jquery.get/
In order not to reload the information every time you make the request, store the last update date in a PHP session variable, this way you will be changed on the screen every time you make the request. echo only on the screen when the inclusion/change date is different.
$.get("minha_pagina_acesso_banco.php",
function(data){
if(data!=''){
$("#result").html($("#result").html()+data);
}
});
Browser other questions tagged php mysql ajax database
You are not signed in. Login or sign up in order to post.
AJAX is the name of asynchronous load technology. Re: http://blog.teamtreehouse.com/beginners-guide-to-ajax-development-with-php
– OnoSendai
If the upgrade is too frequent, using websockets results in better performance and resource savings than Ajax.
– Bacco