I want to know how some web pages move between different PHP pages without reloading the entire page. Here some divs stays the same. If I use AJAX i cannot share the link of the page, so I need to do this. Thank you.
-
what do u mean by "share the link of the page"? – Ashwani May 29 '15 at 16:55
-
Basically he needs to store the Ajax parameters on the url using #, and check for them onload() in order to display the correct page. – Maresh May 29 '15 at 16:57
-
not really the # tag. I need to have complete new pages but having a certain parts as it is over those pages. Like facebook having side bars but have complete links to other pages. Not Aja – Anuradha Wickramarachi Jun 28 '15 at 15:51
2 Answers
You have to use AJAX in order to do that. BUT if you want to be able to share the link or handle reload ou need to build a navigation system using # and some javascript around it.
There is a lot of example for doing that on the web.

- 4,644
- 25
- 30
You could just load a new page and include the same divs of the page :
include 'div1.php';
You could use the other answers below and just use ajax but also build a url at the same time so you can navigate back to the same structure of the page. clicking the link modifies the url, eg:
document.title = document.title + '?div1=true'
Modify the URL without reloading the page
and then just does an ajax call to load a new section. And on first page load, parse the url to check what divs to load.
you could use iframes:
<iframe src="/div1.php" id="div1"></iframe>
And clicking a link loads new stuff to a specific iframe.
-
If I use include 'div1.php' will I be able to retain the that part without reloading in the next page (assuming next page too includes it). And will the expanded collapsible parts will remain as before? Thanks. – Anuradha Wickramarachi Jun 28 '15 at 15:49