So I\'m trying to pass a parameter to a javascript function using the razor \'@\' notation (in an MVC-4 View) but I\'m getting Syntax error: \"Unterminated string constant\"
As alternative, you may use the other way to get @item.ID
in your jQuery function. Just add hiden span with it and get it's value in your function.
Say, you have list:
@foreach (var item in Model)
{
...
-
@item.ID
}
than in your script add:
But to my mind better approach for jQuery is as follows:
@foreach (var item in Model)
{
...
-
@item.ID
}