FormData in javascript?

Why we cant able to console.log FormData in javascript and why it returning empty object?

Why its possible by following code?

   var iterator = form_data.entries();

                for (let e of iterator) {
                  console.log(e);
                  }

because it is empty?

try to console.log an data appended FormData u will see?

Do you have a test script for that?

  var  value =new FormData();

    value.append('name','John');
  
       console.log(value);
1 Like

for me it says FormData { } which simply means there is no display implemented for FormData’s content, since its content is not stored in a simple property.

var value = new FormData()
value.append('name','John')
for (let item of value) {
    console.log(item)  // ["name", "John"]
}
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.