PDA

View Full Version : JavaScript function to change URL


ekko
05-24-2005, 05:50 AM
I have a flash button call the following JS function:


<SCRIPT TYPE="text/javascript">
function jhomeOut(){
curUrl = document.location.href.split("?");
document.location = curUrl[0]+'?subpage=home';
}
</SCRIPT>


Basically I am splitting everything beyond the question mark in the url (i.e. filename.php?subpage=products) and then replacing it with the new document location above.

The problem is when you do this it reloads the entire page. Would it be possible to change:

www.page.com/index.php?subpage=products

to:

www.page.com/index.php?subpage=home

Without reloading the page? Basically I want to change the PHP variable up in the URL bar, but I don't want the page to refresh.

Make sense?

Boskic.com
05-24-2005, 03:04 PM
Maybe this can help
http://www.modernmethod.com/sajax