$(function() {
$('#writeAppointment').on('submit', function(e){
e.preventDefault();
var form = $(this);
var data = new FormData();
form.find(':input[name]').not('[type="file"]').each(function() {
var field = $(this);
data.append(field.attr('name'), field.val());
});
var filesField = form.find('input[type="file"]');
var fileName = filesField.attr('name');
var file = filesField.prop('files')[0];
data.append(fileName, file) ;
var url = 'multisend.php';
$.ajax({
url: url,
type: 'POST',
data: data,
contentType: false,
cache: false,
processData:false,
success: function(response) {
console.log(response)
}
});
})
});
$(function() {
$('#writeAppointment').on('submit', function(e){
e.preventDefault();
var form = $(this);
formData = new FormData(form.get(0));
var url = 'multisend.php';
$.ajax({
url: url,
type: 'POST',
data: formData ,
contentType: false,
cache: false,
processData:false,
success: function(response) {
console.log(response)
}
});
})
});