my script
$("#btnDelete").click(function () {
$.post(url, { fileName: _fileNameAttachementPhoto }, function (data) {
$("#ResumePart4").html(data);
});
});
my controllers
[HttpPost]
public ActionResult DeleteConfirmed(string fileName)
{
var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
FileInfo file = new FileInfo(path);
if (file.Exists) {
file.Delete();
}
return RedirectToAction("DeleteConfirmed");
}
I tried do this but nothing happened.
Try this
$.post('@Url.Action("DeleteConfirmed", "ControllerName")',
{
fileName: FileName
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.