If I were to approach this differently, I would ensure that the links in the menu are valid hyperlinks directing users to specific content. For example, I would link "Contacte" to "http://www.foundcrelamps.com/contacte" so that pasting the URL into a browser will load the page directly.
In addition, I would retain the use of Ajax to prevent the need for reloading the entire page with each click.
One option is to utilize History.js to manage browser history and modify URLs for seamless navigation with Ajax functionality.
To implement this using conventional anchor elements and standard href attributes:
$('a').click(function(){
$('YOUR CONTAINER').load($(this).attr('href'));
return false; // prevents loading the entire page
});
On the server side, code similar to the following may be used:
/* AJAX check */
$isAjax = false;
if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH']==='XMLHttpRequest') {
$isAjax = true;
}
if (!$isAjax) {
outputHeader();
}
outputMainContent();
if (!$isAjax) {
outputFooter();
}
This approach allows for loading only the inner content when utilizing Ajax, while loading the entire page when not.
An alternative method involves loading the entire page with jQuery but replacing only the necessary html content.