diff --git a/assets/js/admin.js b/assets/js/admin.js index e81a6d9..68fb4ee 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -324,10 +324,8 @@ $(errorSelector).html(''); const formData = $(e.target).serializeArray(); const formDataObject = {}; - formData.map((obj) => { - const newObj = {}; + formData.forEach((obj) => { formDataObject[obj.name] = obj.value; - return newObj; }); const postData = { @@ -348,6 +346,11 @@ }, }; + // Add address2 if available. + if (formDataObject.address2 !== '') { + postData.address.address2 = formDataObject.address2; + } + $.post( params.ajax_url, {