Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how to load another page in main page div after click on button
Posted
Comments
enhzflep 15-Apr-14 3:08am    
By using AJAX.
Member 9599723 15-Apr-14 3:09am    
yes
enhzflep 15-Apr-14 3:54am    
My response wasn't a question, it was an answer.
The web is full of tutorials. Pick one and follow it.
Member 9599723 15-Apr-14 5:21am    
that i know very welll


thanksssss

Try like this. May be it helps :)

JavaScript
<div id="topBar">
    <button id="btnHome">Load</button>
</div>
<div id="content">        
</div>

<script>
$(document).ready( function() {
    $("#btnHome").on("click", function() {
        $("#content").load("content.html");
    });
});
</script>
 
Share this answer
 
v2
Try this

You have to include your jquery file that can be downloaded from any website.

HTML
<html>

<body>

<script type="text/javascript" src="your_jquery_file.js"></script>
<script type="text/javascript">
function load_page()
{
     $.post("your_page.html",function(data){
           $("#page_holder").html(data);
     });
}
</script>

<button onclick="load_page()">Load</button>

<div id="page_holder"></div>

</body>

</html>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900