Form submits some trick of the array, and form array trick
Form
Use $. post (
"/Member/book/" + event_id,
{
Tickets: tickets,
Csrf_ppw_token: csrf_ppw_token,
Event_id: event_id,
},
You can pass tickets values to an array of objects.
Browser caputure is
Tickets [0] [fullname]:
Tickets [0] [telephone]:
Tickets [0] [email]:
Tickets [0] [company]:
Tickets [0] [role]:
Tickets [0] [cat_id]: 1
Tickets [1] [fullname]: B
Tickets [1] [telephone]:
Tickets [1] [email]:
Tickets [1] [company]:
Tickets [1] [role]:
Tickets [1] [cat_id]: 1
Csrf_ppw_token: 575b56d0fa9aba282a0f0e4e8dc14c86
Event_id: 1
The server can also use _ post ["tickets"] to obtain this data, but it is not an array of objects, but a two-dimensional array.
When using jquery form, you can manually process formdata,
Var temp = new Object ();
Temp. name = "tickets ";
Temp. value = tickets ;.
The objects uploaded at this time are all stored in the browser caputure
Tickets: [object Object], [object Object]
In this case, assign values using the following method:
Var ticket = new Object ();
Ticket. name = "tickets [" + I + "] [fullname]";
Ticket. value = $ (this). find ($ ("[name = 'fullname']"). val ();
FormData. push (ticket );
Formdata is an array of objects.
Array problems in form
Will not get such an array ..
Do not use arrays... use arr...
After you submit it, use request ("arr ")
You will get the selected value ..
Form submission
Map map = request. getParameterMap ();
Set set = map. keySet (); // set Set of all parameter names
Iterator it = set. iterator ();
While (it. hasNext ()){
String s = (String) it. next (); // an enumeration Parameter
String values [] = request. getParameterValues (s); // obtain the array returned by the corresponding parameter value
Then perform the operations you want, such
For (int I = 0; I <values. length; I ++ ){
Out. println (values [I]);
}
}