initiate formData as JSONObject in the validation function and then push the key values in it. code example
Example 1: for(let [key,val] in obj){ messageBody = messageBody.replace("{"+ key + "}",val) }
for(let [key,val] in obj){
messageBody = messageBody.replace("{"+ key + "}",val)
}
Example 2: for(let [key,val] in obj){ messageBody = messageBody.replace("{"+ key + "}",val) }
for (let key in obj){
messageBody = messageBody.replace("{"+ key + "}", obj[key])
}