Horje
upload form with doc type in ajax Code Example
upload form with doc type in ajax
$(".submitbtn").on("click", function(e) {

    var form = $("#Form");

    // you can't pass Jquery form it has to be javascript form object
    var formData = new FormData(form[0]);

    //if you only need to upload files then 
    //Grab the File upload control and append each file manually to FormData
    //var files = form.find("#fileupload")[0].files;

    //$.each(files, function() {
    //  var file = $(this);
    //  formData.append(file[0].name, file[0]);
    //});

    if ($(form).valid()) {
        $.ajax({
            type: "POST",
            url: $(form).prop("action"),
            //dataType: 'json', //not sure but works for me without this
            data: formData,
            contentType: false, //this is requireded please see answers above
            processData: false, //this is requireded please see answers above
            //cache: false, //not sure but works for me without this
            error   : ErrorHandler,
            success : successHandler
        });
    }
});




Javascript

Related
node js mongodb update by _id Code Example node js mongodb update by _id Code Example
same click event in multiple elements in on event Code Example same click event in multiple elements in on event Code Example
how to read write object to localStorage in js Code Example how to read write object to localStorage in js Code Example
jquery add style background-image Code Example jquery add style background-image Code Example
typescript express next middleware type Code Example typescript express next middleware type Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7