#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    45
    Rep Power
    14

    Getting URL parameters into javascript


    I would like to have a universal error page that I change the message based on a url variable I give it after some serverside error checking. How do I get a javascript funtion to get values from the url???

    Thanks!
  2. #2
  3. No Profile Picture
    Just Diggity
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Location
    Sherman Oaks, CA
    Posts
    126
    Rep Power
    14
    location.search returns the value of the query string in a URL, so if I had a URL like:

    www.mysite.com/index.html?param=value1;

    and then I did:

    var q = location.search;
    alert(q);

    I'd get "?param=value1"
    Dave Pedowitz
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    45
    Rep Power
    14
    Thanks,

    That's exactly what I needed!!

IMN logo majestic logo threadwatch logo seochat tools logo