I have this method that uses AJAX to post data from a form to a web method in the C# backend. Unfortunately, the method is not being hit. I did my research and all accessible resources states that these are the required AJAX options for passing form data to a web method.
Can somebody help me understand why this is not working?
Note: Application is asp.net webforms
<input type="file" id="uploader" />
var fileUpload = $("#uploader").get(0);
var files = fileUpload.files;
var fileData = new FormData();
for (var i = 0; i < files.length; i++) {
fileData.append(files[i].name, files[i]);
console.log(files[i]);
}
$.ajax({
type: "POST",
url: "Pagename.aspx/method",
data: fileData,
contentType: false,
cache: false,
dataType: 'json',
processData: false,
})