Hello Stackoverflower,
a quick question:
I would like to create a DataForm in JavaScript, push the DataForm into an array, send the array to another function, modify in the new function the DataForm and then post the DataForm.
I implemented this like the following abstract, where function1() populates the array with many FormData(), and function2() retrieves each FormData within the array and .set() a new value to the key:
var arrayTempIds = [];
function function1() {
var formData = new FormData();
formData.append("id", value);
arrayTempIds.push(formData);
};
function function2() {
for(var i = 0; i < arrayTempIds.length; i++) {
newId = arrayTempIds[i];
newId.set("id", returndata.id);
}
};
Everything works except the fact that it seems that I cannot write arrayTempIds[i].set(), as the error that comes is:
Uncaught TypeError: undefined is not a function
Does anyone know why?
Luca