1$('body').on('click', '#upload', function(e){
2 e.preventDefault();
3 var formData = new FormData($(this).parents('form')[0]);
4
5 $.ajax({
6 url: 'upload.php',
7 type: 'POST',
8 xhr: function() {
9 var myXhr = $.ajaxSettings.xhr();
10 return myXhr;
11 },
12 success: function (data) {
13 alert("Data Uploaded: "+data);
14 },
15 data: formData,
16 cache: false,
17 contentType: false,
18 processData: false
19 });
20 return false;
21})
22