prepare URI for multiple values with same parameter name.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    prepare URI for multiple values with same parameter name.

    I want to prepare a URI having a parameter name which contains multiple values.
    How do I prepare that URI in JS?
    I mean how browser send those multiple values?
    Please Help me!

    Debasis Jana.
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    How do you want to send those parameters?
    If you are using AJAx for the same, use a variable the required URI and pass it to the xmlHttp.open function or in other case, use window.location = uri_variable;.
    Code:
    var uri_variable = 'mysite.com/index.php?a=' + a + '&b=' + b;

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #3
      Originally posted by hsriat
      How do you want to send those parameters?
      If you are using AJAx for the same, use a variable the required URI and pass it to the xmlHttp.open function or in other case, pass this as an argument to window.location function.
      Code:
      var uri = 'mysite.com/index.php?a= ' + a + '&b=' + b;
      Now Suppose .... i want to send multiple values against parameter "a".
      So that i can use "request.getPar ameterValues" (for JSP).
      You got what i meant?

      Debasis Jana

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #4
        Originally posted by dmjpro
        Now Suppose .... i want to send multiple values against parameter "a".
        So that i can use "request.getPar ameterValues" (for JSP).
        You got what i meant?

        Debasis Jana
        I got the solution, what a fake question i made.
        it will be page?parameter_ name=parameter_ value&parameter _name=parameter _value......
        actually i got from my self ..simply make the request GET and ..submit the page ..and have a look at the address bar of the browser.

        Debasis Jana .... So shamed of me!

        Comment

        • hsriat
          Recognized Expert Top Contributor
          • Jan 2008
          • 1653

          #5
          Originally posted by dmjpro
          I got the solution, what a fake question i made.
          it will be page?parameter_ name=parameter_ value&parameter _name=parameter _value......
          actually i got from my self ..simply make the request GET and ..submit the page ..and have a look at the address bar of the browser.

          Debasis Jana .... So shamed of me!
          In JSP and ASP, multiple GET variables with same name makes an array at the server end.
          In PHP, square braces, [ ] are needed (like variable[ ]) to make it an array.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Originally posted by dmjpro
            I got the solution, what a fake question i made...[snip]... So shamed of me!
            Not necessarily. Sometimes, by typing out your problem, it let's you think about it more and you figure it out yourself.

            Comment

            Working...