Content that loads other pages without updating the masterpage

Asked

Viewed 63 times

2

Hey, how you doing? I would like to make a side menu with the loading of a page next to it, only when selecting an item from the menu, I do not want it to be loaded 100% of the page but only that specific part. I already tried to create a masterpage by calling it on the content page, but I don’t have the result I expect.Here’s an example in the image:

<?php include 'masterpage.php' ?>

inserir a descrição da imagem aqui

As the image shows, I would like to upload only the part that is blank, that would be my content.

1 answer

4


With ajax you do just that, you can fire a function with jquery by clicking on a given menu element, you can read about ajax in: http://api.jquery.com/jquery.ajax/ but let us illustrate: your menu item is:

  <li id="pag1">Pag1</li>

now in the jquery part you will make a function to monitor when it is clicked

$("#pag1").click(function(){
  $.ajax({
type :"POST",
 async: false,
 url: paginadeconteudo.php",
}).done(function(data){
    $("#conteudo").html(data);  // isso fara com que tudo que tu 
   // colocou para mostrar em paginadeconteudo será exibido da div 
  //  conteúdo que seria o teu meio.
});

}

Browser other questions tagged

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