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

    Join Date
    Dec 2006
    Location
    Athens, HELLAS
    Posts
    177
    Rep Power
    45

    Request.getParameter in JavaScript


    What I want to do is to retrieve a value passed from a form to a page.
    In JSP pages I use:
    Code:
    String code=request.getParameter("id");
    between <% and %>.
    What should I use to do the same thing in JavaScript (between <script type="text/javascript"> and </script>).
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    JavaScript is a client side language. It can not access posted information. It can access the query string, however, by using window.location.search.

    Comments on this post

    • spiretos agrees : Thank you!
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2006
    Location
    Athens, HELLAS
    Posts
    177
    Rep Power
    45
    Thank you!
    That's very useful!
    If anything comes up, I'll post.

IMN logo majestic logo threadwatch logo seochat tools logo