effective way to POST an array of parameter code and values

Discussion in 'HTML' started by jrefactors@hotmail.com, Dec 27, 2004.

  1. Guest

    If we have an array of parameterCode and parameterValue, what is the
    best way to POST those
    information?

    Approach #1, I don't think this will work

    parameterCode=1A&parameterValue=1B&parameterCode=2A&parameterValue=2B&parameterCode=3A&parameterValue=3B

    Approach #2:

    parameterCode_1=1A&parameterValue_1=1B&parameterCode_2=2A&parameterValue_2=2B&parameterCode_3=3A&parameterValue_3=3B
    Please advise. thanks!!
     
    , Dec 27, 2004
    #1
    1. Advertising

  2. SPG Guest

    Why not post all the values in one param, concatenated and separated by a
    delimiter?

    So...

    IE:

    parameterCode=paramVal1|paramVal2|paramVal3 and so on..

    Then in the script to read the vals, you can do this:

    var paramArray = parameterCode.split("|");

    which would give you an array of strings based ont he value of the
    parameterCode variable

    (Note: Assuming you are passing the value of the post parameter
    "parameterCode" to a function..)

    Bit vauge and sketchy but hopt this points you to the rigth solution

    Steve

    <> wrote in message
    news:...
    > If we have an array of parameterCode and parameterValue, what is the
    > best way to POST those
    > information?
    >
    > Approach #1, I don't think this will work
    >
    > parameterCode=1A&parameterValue=1B&parameterCode=2A&parameterValue=2B&parameterCode=3A&parameterValue=3B
    >
    > Approach #2:
    >
    > parameterCode_1=1A&parameterValue_1=1B&parameterCode_2=2A&parameterValue_2=2B&parameterCode_3=3A&parameterValue_3=3B
    > Please advise. thanks!!
    >
     
    SPG, Dec 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Harry
    Replies:
    1
    Views:
    424
    Joe Fallon
    Apr 13, 2004
  2. Replies:
    2
    Views:
    342
    Eliyahu Goldin
    Jan 8, 2006
  3. Replies:
    1
    Views:
    1,033
    Pascal J. Bourguignon
    Apr 22, 2008
  4. Ryan Liu
    Replies:
    4
    Views:
    402
    bruce barker
    Jan 20, 2009
  5. Replies:
    1
    Views:
    102
Loading...

Share This Page