页面导航在php ...显示与重新加载前相同的内容

I have a web page with the following layout:

Navigation Pane         --------------content pane---------------
item1                   -                                       -
item2                   -                                       -
item3                   -                                       -
item4                   -                                       -
item5                   -----------------------------------------

So when i click on item1 the content pane shows content related to item 1 and so on. I am using $.post() to retrieve data.

The problem is when i reload the page with a particular item selected, i will be shown the content related to the default selected item for the page(say item1). How should i implement so that when i reload the page i am shown the content corresponding to the previously selected item.

This is the same as the facebook's nav pane for navigating through groups and news feed.

Please Help me out here..

You could try this:

Add a hash tag to the links:

<a href="#item1">item1<a>
<a href="#item2">item2<a>
...etc

When the page reloads, check the hash tag and load the relevant content:

loadMyContent(window.location.hash) //where loadMyContent is your own function

Since you refused to post code (you should always post code), I'm just trying to demonstrate the general idea. It would need to be edited to be compatible with your project. You might also want to do some sanitisation on the window.location.hash to avoid JS errors with non-existent items.

have an index.php as your controller page with following code

$action=$_GET['status'];
switch($action)
{
     case 'item1': include_once "item1_content.php";break;
     case 'item2': include_once "item2_content.php";break;
     default : include_once "default_page.php";break;

}

next,the individual nav bar links sud be like the following

<a href="index.php?status=item1">item1</a>
<a href="index.php?status=item2">item2</a>
<a href="index.php">Link to default content</a>

what basically happens is that whenever u click on a link,u will be redirected to index page along with status flag set and based on the status flag,appropriate content will be displayed. Secondly,since the url has the status set even on refresh,there won't be a redirection to default content.

Hope it helps..!!