Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6376
  • Last Modified:

Possible to change URL parameters thru Javascript without refreshing?

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?
2 Solutions
>>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.

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 ..

David H.H.LeeCommented:
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:

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>

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now