send parameters with file ajax jquery

Solutions on MaxInterview for send parameters with file ajax jquery by the best coders in the world

showing results for - "send parameters with file ajax jquery"
Stefania
14 Oct 2020
1$(function() {
2    $('button[type=submit]').click(function (event) {
3        event.preventDefault();
4
5        // retrieve form element
6        var form = this.form;
7        // prepare data
8        var data = new FormData(form);
9        // get url
10        var url = 'wherever.php';
11
12        // send request
13        $.ajax({
14            type: 'POST',
15            url: url,
16            data: data,
17            processData: false,
18            contentType: false
19        });
20    });
21});
22