0

I'm trying to reload the same page with new parameter for example.

www.mysite.com/hi/hi/yo/default.aspx to redirect to www.mysite.com/hi/hi/yo/default.aspx?querystring=helloworld.

What I really need to do is redirect to www.mysite.com/hi/hi/yo/default.aspx to redirect to www.mysite.com/hi/hi/yo/default.aspx?Myparam=yellow and i dont want to hardcode `www.mysite.com/hi/hi/yo/default.aspx

Thanks

1 Answer 1

1

This will redirect www.mysite.com/hi/hi/yo/default.aspx to www.mysite.com/hi/hi/yo/default.aspx?Myparam=yellow

location.href=location.href + '?MyParam=yellow'

You can do also:

if (location.href=='http://www.example.com/hi/hi/yo/default.aspx')
    location.href=location.href + '?MyParam=yellow'
Sign up to request clarification or add additional context in comments.

2 Comments

That sort of works, but it doesnt get the current parameters, so i have ?myparam1=hello&myparam2=yo&myparam3=yellow
What is the current parameters?. Please explain