Solved

Possible to change URL parameters thru Javascript without refreshing?

Posted on 2008-06-24
3
6,364 Views
Last Modified: 2010-05-18
I've got a page that has a few url parameters. There's a couple of modes the page can be entered in, with correspondingly different urls params. Also with the same page many of the processes are done thru AJAX without page refresh. My problem is that the AJAX updates makes the URL params old. Is there a way to update the URL parameters thru AJAX so the URL always stays current? I don't want to refresh the page because it'll defeat the AJAX feature of the page. Is this possible?
0
Comment
Question by:bemara57
3 Comments
 
LVL 82

Assisted Solution

by:hielo
hielo earned 150 total points
ID: 21857113
>>Is there a way to update the URL parameters thru AJAX so the URL always stays current?
The url params of what? The current/main page? If that is what you are referring to, the instant you change the location.href, you will essentially "refresh" the current page. If you are referring to the page you are submitting the request to, then yes, you can change the params as needed. If you are calling some function, pass the parameters through the function and update the url within the function.
0
 
LVL 22

Expert Comment

by:neeraj523
ID: 21858512
hello

You cant change the URL or querystring runtime (on fly) without page refresh.. instead you should try to update varaibles in your page which is reading values form querystrings and passing these to redirection pages.. you can change these varaible values in between before going to second page..

Hope it will make sense ..

neeraj523
0
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 350 total points
ID: 21858571
Hi bemara57,
Probably you can try window hash object to resolve your cases.

Here is the sample how to use the mentioned - right click and view the source code there:
http://www.mikage.to/jquery/jquery_history.html#3

Note: You need to download the js files that provide in the articles that given above.
<script type="text/javascript" src="jquery-1.1.1.js"></script>
<script type="text/javascript" src="jquery.history.js"></script>


0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now