I'm trying to create a dynamic web page to show some content and change it without reloading the full page but some part of it.
When i press a button of my navigation bar it calls a JavaScript function to change the content of my div tag
<div class="row text-left" id="center"></div>
with this code i put into my div class some text
$('#navHome').click(function(){
$('#center').html("this is my home");
});
Now i want store a content of every section to reload this every time when i press the button. Something like this:
$('#navHome').click(function() {
$.get('home.txt', function(data) {
$("#center").html(data);
}, 'text');
});
in the home.txt i have store my html code of home section but i have no idea how to make this.