JSFiddle - React, Tailwind, and code Playground
HTML
<form method="post" id="opretMedlem" enctype="multipart/form-data">
<input type="text" name="info[name]" class="form-control1 info" />
<input type="text" name="info[age]" class="form-control1 info" />
<input type="file" name="info[image]" class="form-control1 info" />
<input type="submit" name="submit" class="btn btn-info" value="Create member" />
</form>
JavaScript
$('#opretMedlem').on('submit', function(event){
event.preventDefault();
var form_data = $(this).serialize();
var form = $(this)[0];
var data = new FormData(form);
$.ajax({
url:"scripts/createMember.php",
enctype: 'multipart/form-data',
method:"POST",
data:data,
cache: false,
contentType: false,
processData: false,
success:function(data) {
alert('done');
}
});
});