javascript - FormData() XHR2 - Stack Overflow

I am trying to use FormData(). I have tried this code in Multiple versions of Chrome and Firefox.var fD

I am trying to use FormData(). I have tried this code in Multiple versions of Chrome and Firefox.

var fData = new FormData();
fData.append('foo', 'bar');
console.log('formData', fData);

fData, when logged, only gives me the created object with a prototype of FormData and no additional "foo" value. There are no errors, it just seems to fail silently.

I have also tried

var fData = new FormData(formElement);

I am trying to use FormData(). I have tried this code in Multiple versions of Chrome and Firefox.

var fData = new FormData();
fData.append('foo', 'bar');
console.log('formData', fData);

fData, when logged, only gives me the created object with a prototype of FormData and no additional "foo" value. There are no errors, it just seems to fail silently.

I have also tried

var fData = new FormData(formElement);
Share Improve this question asked Jan 3, 2012 at 17:31 Chris BiscardiChris Biscardi 3,1532 gold badges22 silver badges19 bronze badges 2
  • Have you found a solution for this? I am experiencing the same problem. – aganders3 Commented Jan 11, 2012 at 18:09
  • @aganders3 Not yet. I'll post it here if I do. – Chris Biscardi Commented Jan 11, 2012 at 19:37
Add a ment  | 

1 Answer 1

Reset to default 7

Doing a bit of research, I found this question which says you can't get your data directly from the FormData object. However, you can see what data is sent if you examine the XMLHttpRequest object after sending it. This allowed me to see what I was sending (I used the network tab of Chrome's inspector) and effectively debug my code.

So to answer your question: it is probably working already, you just can't see your data in the FormData object.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745344187a4623467.html

相关推荐

  • javascript - FormData() XHR2 - Stack Overflow

    I am trying to use FormData(). I have tried this code in Multiple versions of Chrome and Firefox.var fD

    2小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信