I
I
Ilya Beloborodov2016-05-14 21:05:36
JavaScript
Ilya Beloborodov, 2016-05-14 21:05:36

string to array?

There is a form, I serialize() it, and it turns out
nameProfile=Name&phoneProfile=0123456789&commands[0][name]=Comand1&commands[0][code]=code555
how to get such an array from the form data, well, or the line above

[
    {
        nameProfile:'Name'
    },
    {
        phoneProfile:'0123456789'
    },
    {
        commands:{
            [
                name:'Comand1',
                code:'code'
            ]
        }
    }
],
ну или что-то типа такого. Мне просто на клиенте нужно это все обработать и сохранить а localStorage

Answer the question

In order to leave comments, you need to log in

2 answer(s)
#
#algooptimize #bottize, 2016-05-14
@kowap

https://api.jquery.com/serializeArray/
or
stackoverflow.com/questions/1184624/convert-form-d...

T
ThunderCat, 2016-05-14
@ThunderCat

If there is a form - why serialize?
Maybe json() will be easier right away?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question