Julio Mejia
Julio Mejia

Reputation: 11

Values in FormData Javascript

How can I see the key-value values ​​that I have in a FormData when I capture it in this way:

var formdata = new FormData (form);

When I print in the Deveploment Tolols console this way:

e.preventDefault ();
var form = $ ('# frmSede') [0];
var formdata = new FormData (form);
var oEstado = new FormData (document.forms.namedItem ("state"));
console.log ("The state is:" + oEstado);

I printed on the screen, the following:

[object FormData]

I would like to see the values ​​of each value in the key-value in order to add a logic before sending the data to a rest service. Thanks in advance friends.

Upvotes: 1

Views: 54

Answers (1)

smnbbrv
smnbbrv

Reputation: 24541

You are casting it explicitly to the string. Try comma:

console.log ("The state is:", oEstado);

This will not properly work in old browsers like ie9 etc., for all other cases this should be enough

Upvotes: 1

Related Questions