0

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.

1
  • please add DeleteConfirmed Get Action. PLease check URL also Commented Jul 11, 2013 at 3:00

1 Answer 1

3

Try this

 $.post('@Url.Action("DeleteConfirmed", "ControllerName")',
            {
                fileName: FileName
            });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.