I would like to be able to display various content (from other pages) on a single page for each click on a link or button that the user gives. I know that one of the solutions would be to use AJAX, but the problem is that when I give a refresh , the content that is visible at the moment adds up and returns that of the main page, what I would like is to remain in the same page with the same content before refresh .
The Javascript code I use is this:
$.ajax({
url : './pagina.php',
type : 'POST',
cache: false,
data : 'dado=' + dado,
beforeSend: function () {},
complete: function () {},
success: function(data){
$('#showInfo').html(data); // $('# showInfo').show();
},
error: function(){
// comandos a serem executados caso Houver algum
});
Another one I've also used is:
$.get("pautas.php?acao=1", function( data ) {
$('#content').html(data);
});
Can anyone please give me a tip ??