1$(".submitbtn").on("click", function(e) {
2
3 var form = $("#Form");
4
5 // you can't pass Jquery form it has to be javascript form object
6 var formData = new FormData(form[0]);
7
8 //if you only need to upload files then
9 //Grab the File upload control and append each file manually to FormData
10 //var files = form.find("#fileupload")[0].files;
11
12 //$.each(files, function() {
13 // var file = $(this);
14 // formData.append(file[0].name, file[0]);
15 //});
16
17 if ($(form).valid()) {
18 $.ajax({
19 type: "POST",
20 url: $(form).prop("action"),
21 //dataType: 'json', //not sure but works for me without this
22 data: formData,
23 contentType: false, //this is requireded please see answers above
24 processData: false, //this is requireded please see answers above
25 //cache: false, //not sure but works for me without this
26 error : ErrorHandler,
27 success : successHandler
28 });
29 }
30});
31