after using this code to send params through ajax:
paramsToSend = $form.serializeArray();
params = JSON.stringify(paramsToSend)
I got this array after decode json on serverside:
Array
(
[0] => Array
(
[name] => name
[value] => Naomi
)
[1] => Array
(
[name] => password
[value] => test123456
)
[2] => Array
(
[name] => email
[value] => naomitest@gmail.com
)
[3] => Array
(
[name] => code
[value] => test123456@test123456
)
[4] => Array
(
[name] => phone
[value] => 423523545435
)
)
-
Can I convert it to Object and get value like this:
User.name //will print Naomi User.password // will print test123456
Because I need other different params for ajax call, is the way I serializeArray data + convert to json best practices? If not please give me advice. Thanks