If I have an html form where the name values are:
name="main[name]"
name="main[email]"
name="main[info]"
How would I go about getting all the values of the array in the form of:
main : { name : 'value', email : 'value', info : 'value' }
I've tried jquery's serialize()
from an older stack (Obtain form input fields using jQuery?) question but that solution gives me an array along the lines of
{ 'main[email]' : 'value', 'main[email]' : 'value', 'main[info]' : 'value' }
EDIT: reason i'm doing the main[email]
format is because I have an extra input there for csrf which I need to differentiate from the actual input values, the final array is gonna be something like:
[ csrf: '', main : { name : 'value', email : 'value', info : 'value' } ]
this way I can just use main
values.