var baseurl = "inwww.mysite.com";
var isquery = "?";
var actual = "1";
var val = "val="+actual;
top.location = baseurl+isquery+val
// this should return inwww.mysite.com?val="1"
you can adopt this to your script and on click of a button you can change the actual variable to "2"
this way you could easily change the query string.
On Fri, May 1, 2009 at 11:39 PM, mkmanning <michaellise@gmail.com> wrote:
If that's all you need for the search property, then just use
window.location.host + '?key=val#'
On May 1, 1:39 pm, buntu <buntu.w...@gmail.com> wrote:
> Here is an example:
>
> I need to append '?key=val1' to the current url which is
> www.mysite.com/web/test.html
>
> and this I can do using:
> window.location.href+'?key=val1' resulting inwww.mysite.com/web/test.html?key=val1
>
> I now need a way to modify val1 to val2, if I do:
> window.location.href+'?key=val2' results in www.mysite.com/web/test.html?key=val1?key=val2
>
> but I need: www.mysite.com/web/test.html?key=val2
>
> There are ways to break down the url but wanted to know if there is
> anything jQuery already provides. Thanks!
>
> On May 1, 1:22 pm, waseem sabjee <waseemsab...@gmail.com> wrote:
>
> > ok so you wanna edit the URL ?
>
> > var url = "www.google.co.za";
> > top.location = url;
>
> > this will send the page towww.google.co.za
>
> > var url top.location;
>
> > this shoud retrieve the URL
>
> > Sorry. I'm unable to fully answer your question at this time.
>
> > On Fri, May 1, 2009 at 10:17 PM, buntu <buntu.w...@gmail.com> wrote:
>
> > > Hi,
>
> > > I need to append a parameter string like: '?key=val' to the current
> > > url and the value for the key changes based on the user input. Is
> > > there any jquery utility that does the base url extraction from
> > > window.location, so that I can append the '?key=val' to that?
>
> > > Thanks for the help!
No comments:
Post a Comment