Error Passing javascript values using Url.action()

0

I am using url.action to pass values to my controller

with the below example

onclick="location.href='@Url.Action("result", "Checking", new { id = "Name" })'">

it comes out with an error of

Unhandled exception at line 185, column 13 in http://localhost:51086/Checking/result/Name 0x80070005 - JavaScript runtime error: Access is denied.

while the program works fine with

onclick="location.href='@Url.Action("result", "Checking")?id=Name'">

Would like to know the difference of passing value using routevalue of Url.Action

Thanks

javascript
model-view-controller
asked on Stack Overflow Oct 17, 2019 by whoami

1 Answer

0

try this one

onclick="location.href='@Url.Action(\"result\", \"Checking\", new { id = \"Name\" })'">
answered on Stack Overflow Oct 17, 2019 by Karthick

User contributions licensed under CC BY-SA 3.0