Karan Thakkar

Karan Thakkar

  • 1.7k
  • 203
  • 20.5k

How call controller Action result with Ajax in Mvc?

Sep 23 2019 1:37 AM
I want to call controller ActionResult from an ajax call which has one string paramenter.
like this
public ActionResult DeleteFile(string filePath) {
return Json(string.Empty, JsonRequestBehavior.AllowGet);
--Ajax call in jquery looks like this. when I am passing filePath without any special character ActionResult gets called but not when I pass below string.
var filePath='/OnlineFdDocument/200//UIDAI-Aadhar-Card-Updates-2-644x362.jpg'
url: "/AreaName/Document/DeleteFile/" + filePath,
dataType: "json",
type: "Post",
contentType: 'application/json; charset=utf-8',
data: { "docUrl": docUrl },
success: function (data) {
If anyone can help me out the please reply.
Thank You...

Brought to you by:

Answers (4)