Hi I am using following techniques to Load different pages with menu bar. When ever i click on any menu bar button it loads the pages without page refresh. But When I am in any other page except Home Page and i want to refresh or submit that page it again loads Home page.
Menu
<ul id="navigation"> <li><a href="javascript:loadContent(1);">Home</a></li> <li><a href="javascript:loadContent(2);">Services</a></li> <li><a href="javascript:loadContent(3);">About</a></li> <li><a href="javascript:loadContent(6);">Contact</a></li> </ul>
Jquery PageLoad
function loadContent(id) { $("#pagehandler").load("loadpage.php?pageid="+id+""); }
Page Load in Body
<div id="pagehandler"></div>
php file code
switch($cOption) {
case 1:
$extra = 'home.php';
header("Location: http://$host$uri/$extra");
break;
case 2:
$extra = 'Services.php';
header("Location: http://$host$uri/$extra");
break;
开发者_Go百科 case 3:
$extra = 'about.php';
header("Location: http://$host$uri/$extra");
break;
default:
echo 'Whoops, didn\'t understand that option: <i>'.$cOption.'</i>';
}
?>`
From this sample code you can understand the process of code execution. When i click ony menu button.
How can i refresh any page using f5 with loading home page.
It seems that you the first branch of the switch statement is executing. Have you verified this?
I would have the home redirect be the default and only check for known values that are no home.
精彩评论