Access Values Created by SerializeArray in JQuery

Posted on April 13, 2020 at 10:15 pm

Here is a quick example of using jQuery .serializeArray() function and then convert all the serialized data into an array, so you can easily access single POST values:

$(document).ready(function() {
        var fieldsArray = $("form").serializeArray();
        fieldsLen = fieldsArray.length;
        fieldsObj = {};		
        for (i=0; i<fieldsLen; i++) {
            fieldsObj[fieldsArray[i].name] = fieldsArray[i].value;
        // Access POST field "test"

Receive updates via email

Other Posts

Updated Posts