I want to call controller ActionResult from an ajax call which has one string paramenter.
like this
[HttpGet]
[Route("AreaName/ControllerName/MethodName/{filePath}")]
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'
$.ajax({
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...
Jaimin ShethiyaPosted Sep 23, 2019, 9:06 AM
You have written in MVC C# method is GET and Ajax call you have method type is POST so that is not correct first you have correct that one and please make sure this type of the mistake in future.
can you please try the above code.
let me know if you have needed anything from side.
Thanks
Karan ThakkarPosted Sep 23, 2019, 2:48 AM
Karan ThakkarPosted Sep 23, 2019, 2:33 AM
Amit MohantyPosted Sep 23, 2019, 2:05 AM