I have made a simple form and want to post the data using the jQuery function new FormData()
. To me every thing seems to be good but when I am displaying the variable data
in console.log
, then I get FormData { append=append()}
as output.
My code is:
<form action="" enctype="multipart/form-data" method="post" name="edit_user" id="edit_user">
<input type="text" name="Fname" >
<input type="file" name="image">
<input type="submit" value="submit">
</form>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#edit_user').submit(function(event) {
event.preventDefault();
var formdata = new FormData(this);
console.log(formdata);
});