I have an existing HTML form with several fields. I would like to use Dropzone to enhance the forms file input (listing thumbnail image upload) but I don't want to use any of Dropzones built in file uploading functionality. I simply need to access the selected files and send them along with my other form data, via AJAX, on my form submit.
$(document).one('submit', '#account-group-add-form', function(e) {
e.preventDefault();
// Form validation.
// Build an array of the form vars.
var form_values = {};
// I add all of the forms data to this structure then send via AJAX.
// Send the data to the server.
$.ajax({
type: 'POST',
url: sp23_ajax.ajaxurl,
data: {
'action': 'sp23_account_group_add',
'data': JSON.stringify(form_values)
},
success: function(data) {
// Success.
}
});
});