I have formData from <form> element and I want to get content of elements inside form, but with formData. As you can see, I'm not using formData.append(). Also, please, do not post answers with form.find('input').val(), because it doesn't answer my problem. I will use that formData in the ajax, that's why I am here.
Simple example:
$(function() {
var form = $('#test');
form.on('submit', function(e) {
e.preventDefault();
var formData = new FormData(form[0]);
console.log(formData.get('file'));
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form enctype="multipart/form-data" id="test">
<input type="file" name="file" accept="image/*">
<input type="submit">
</form>
console.log()showing for you! I can see file info at my end!Uncaught TypeError: formData.get is not a function