ajax send file jquery code example
Example: send parameters with file ajax jquery
$(function() {
$('button[type=submit]').click(function (event) {
event.preventDefault();
// retrieve form element
var form = this.form;
// prepare data
var data = new FormData(form);
// get url
var url = 'wherever.php';
// send request
$.ajax({
type: 'POST',
url: url,
data: data,
processData: false,
contentType: false
});
});
});