0

I want to include some pages into a div but I don't know how. The code with the problem is below

I want to include a page in a content div, so when I click on contact in the navigationbar the contact.php needs to be loaded in the index.php's content div and when I click on about us in the navigationbar the about.php page is included into the index.php's content div..

<html>
   <body>
     <div id="navbar">
       <ul>
         <li>
            home
         </li>
         <li> 
            about us
         </li>
         <li>
            contact
         </li>
       <ul>
     <div id="content">
         <!--so when the user clicks on contact us there needs 
             to be an include in this div wich includes the contactus.php page.
         -->
         <?php include 'contactus.php'; ?>
     </div>
   </body>
</html>
PhearOfRayne
  • 4,990
  • 3
  • 31
  • 44
Najib Bijan
  • 1
  • 1
  • 1

1 Answers1

1

Recode ul like below

 <ul>
             <li id="home">
                home
             </li>
             <li id="aboutus"> 
                about us
             </li>
             <li id="contact">
                contact
             </li>
           <ul>

   $(document).ready(function(){
  $("#home").click(function(){
    $("#content").load("home.php");
  });
});

same for contact and aboutus
user7789076
  • 798
  • 2
  • 12
  • 25