effective way to POST an array of parameter code and values

J

jrefactors

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!!
 
S

SPG

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top