Answers for "send parameters with file ajax jquery"

0

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
        });
    });
});
Posted by: Guest on July-26-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language