i am relatively new in Javascript and jquery.
I have create an array of object using serializeArray() ,
var form_data = $("some_id").serializeArray();
where form_data returns data in the folliwing format,
[obj, obj, obj, obj]
where each obj contains data in this structure,
0: object
"name": "hotel_id"
"value": "1"
but i want it to be return in the following format,
{"hotel_id": "1"}
to do so i have tried the following code initially to either return the name or the values
var myArray = $.map(form_data, function(element) {
return element.value;
});
its only returning the values in this way,
["1"]
how can i return the result in {"name": "value"} pair.
serializeArray()docs which always returns same structure