Sending Parameters via URL

Discussion in 'JavaScript' started by mberman84, Nov 24, 2008.

  1. #1
    I have this script in PHP, and I want to do this with javascript:

    header("Location: http://site.com/&subid=" . $_GET["subid"]);


    so I want to basically do this in javascript. I want to grab the parameter "subid" from the URL and append it to the URL i am redirecting to. it would be something like this:

    window.location = "http://site.com/&subid="; but what goes here?

    how do i grab the parameter and append it.


    thanks!
     
    mberman84, Nov 24, 2008 IP
  2. twomanriot

    twomanriot Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    gaybo wilson - great question
     
    twomanriot, Nov 24, 2008 IP
  3. mberman84

    mberman84 Peon

    Messages:
    511
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    can anyone help me with this?
     
    mberman84, Dec 1, 2008 IP
  4. cyberjag

    cyberjag Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I think you can do this in two steps.

    1. Grab the $_GET['subid'] and write it to a hidden field value.
    For eg. use a hidden input field and set the value as $_GET['subid']

    2. In the javascript get the document element by id and get the value. Append this value to the window.location.

    Hope this helps.
     
    cyberjag, Dec 7, 2008 IP