How to combine two javascript FormData objects
I need to combine two FormData objects and post them using XMLHttpRequest. One of the forms contains file input. var formData = new FormData(document.forms.namedItem('form-ship')); var poData = new FormData(document.forms.namedItem('po-form')); // Combine them var fData = $.extend(true, formData, poData); It doesn't work when I use $.extend or if I use serialize() to combine the form that doesn't have file input. Any idea how to do this? You cannot. FormData is unfortunately not enumerable. However, as you say only one of your forms does contain a file input. Then it should be possible to use