How to inspect FormData?

前端 未结 15 1516
悲&欢浪女
悲&欢浪女 2020-11-22 08:23

I\'ve tried console.log and looping through it using for in.

Here it the MDN Reference on FormData.

Both attempts are in this fi

15条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 08:27

    in typeScript of angular 6, this code is working for me.

    var formData = new FormData();
    formData.append('name', 'value1');
    formData.append('name', 'value2');
    console.log(formData.get('name')); // this is return first element value.
    

    or for all values:

    console.log(formData.getAll('name')); // return all values
    

提交回复
热议问题