I have a jQuery exception
"Uncaught TypeError: Illegal invocation" in line "data: formData",
when I try to send the next request:
$("#loader").on("change", function (data) {
var formData = new FormData($('form')[0]);
$.ajax({
url: "/Admin/SaveImage",
type: "post",
data: formData,
success: function (path) {
if (path.value != "") {
$("#picture").attr("src", path.value);
$("#loader").val(null);
}
}
});
});
$("#loader").on("change", function () {
if (this.files && this.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$("#picture").attr("src", e.target.result);
}
reader.readAsDataURL(this.files[0]);
}
});