I am looking for the way to pass the parameter from Ajax Request to Web API Controller in ASP.Net Core like query string in classic ASP.
I have tried below but it did not worked.
View:
"ajax":
{
"url": "/api/APIDirectory/[email protected]"
"type": "POST",
"dataType": "JSON"
},
Controller:
[HttpPost]
public IActionResult GetDirectoryInfo(string reqPath)
{
string requestPath = reqPath;
// some code here..
}
Can anyone please advise the ways available to achieve this in asp.net core web api?
@ViewBag.Titleis not empty.