Here's my form:
<form id="content-add-form" role="form" name="content-add-form" enctype="multipart/form-data">
I'm trying to get form data using:
var formData = new FormData($('#content-add-form'));
But it's not working, any ideas why?
Here's my form:
<form id="content-add-form" role="form" name="content-add-form" enctype="multipart/form-data">
I'm trying to get form data using:
var formData = new FormData($('#content-add-form'));
But it's not working, any ideas why?
Try this
var formData = new FormData($('#content-add-form')[0]);
You need to pass the actual form element - not the jQuery object containing it.
https://developer.mozilla.org/en-US/docs/Web/API/FormData
Constructor
new FormData (optional HTMLFormElement form)
As for why you can't see the data, read here: How to inspect FormData?
Working example: http://jsfiddle.net/TGzRa/