Hi All,

I am new to Ajax. I have updated my website with Ajax code. How should I get unique url after click on menu. I mean if I click on "about me" on my website yogawithgauri.com. the url in the address bar should be yogawithgauri.com/aboutme

Please let me know how I can do this

Thanks & Regards
Gauri

Recommended Answers

All 8 Replies

It's simple - just don't use ajax for navigation.
Ajax does not change address bar.

thanks for quick reply...its so simple. But then how will i display the content on the same page after clicking on the menu

You need to make your navigation menu without ajax.
Each navigation method on the server must render whole page, not just block content.

thanks for understanding me. I am very new to ajax so where can i read more about this. Currently I don't understand the rendering of block content or the whole page...

I will also try to google mean while

Look, ajax sends a request and loads response into the page element (div with id='ajax').
Your ajax call looks like this

<a href='javascript:ajaxpage('aboutme.php', 'ajax')'>...</a>

second argument of function call is id of element where need to load response.
Your file 'aboutme.php' contains some html (without 'html', 'head' and 'body' tags).
This is what I call 'content of block'.

Try to copy whole html code from index.php to aboutme.php and make changes in the navigation menu structure.

<a href='aboutme.php'>About Me</a>

And click on it. Your address in the address bar will be changed to http://yogawithgauri.com/aboutme.php

Thanks for explaining me. I had this code before trying to ajax. The problem with this is that the whole page is loaded again. I do not want to load the menu, banner, logo etc to reload with every click, just the content should be reloaded. But then I ended up missing the unique address bar. I need something like below

http://www.mindtree.com/

That site maked like I've said. It's reloading whole page when navigation link clicked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.