I'm creating a website, where I want to use the div from the main page to switch between other pages. For example, I have the 'index', 'content 1' and 'content 2'. I want to make when I click the link, change the content from 'index' to 'content 1', without having to load another page, maintaining the normal logo, menu and footer of the site.
I want to know how I do this in code, because I've tried some that I've seen the guys doing, in many ways and did not work, the div is not changing to the page div I requested. Remember that I use Wamp, the page has the library link in the header and etc. etc.
Edited: So @AsuraKhan, I read your answer and went to seek to understand more about, but it has not yet come to clarity. I made a brief summary of what I'm trying to do here for you to understand what I want to do. Example:
- Index.html
</head>
<body>
<div id="menu">
<ul>
<li>
<a href="conteudo2.html" id="a1">Conteudo 2</a>
</li>
<a href="conteudo3.html" id="a2">Conteudo 3</a>
<li>
</li>
</ul>
</div>
<div id="conteudo" class="content">
<h1>CONTEUDO 1</h1>
</body>
Content 2 (content2.html) and 3 only change the class, the id is the same.
And the script I'm trying is this:
<script type="text/javascript">
function Load(View){
$("#conteudo").load(View);
};
$(document).ready(function(e) {
$("#a1").click(function(e) {
Load('conteudo2.html');
});
$("#a2").click(function(e) {
Load('conteudo3.html');
});
});
</script>
Basically that's it, I can not decipher the error.