I need to send data from a form via ajax to the server (php). I used the FormData () object but without success. Part of my jquery:
var formdata = new FormData($("#myform"));
var link = "form/insert";
$.ajax({
type: 'POST',
url: link,
data: formdata ,
processData: false,
contentType: false
}).done(function (data) {
$("div.container-fluid").html(data);
});
My html has:
<input type="text" class="form-control" id="name" placeholder="name" name="name">
<input type="file" id="arquivo" name="arquivo" />
Running the script only returns null. I would like to send via ajax the input text and the file?