Restore it to make it clearer. Literally equivalent:
var deleteUrl = '<%:Url.ActionLink("Delete", "DeleteElementFromSet", new {id=%>Id<%})%>'; $("#Table").last() .append('<tr><td><a href=\"' + deleteUrl + '">Delete</a></td><td>'+Id+'</td></tr>');
First of all, you may notice that you open it with \" and close it with " .
I suggest you complete the exercise above until the script is clear and the confusing syntax is reproduced.
It is said above that in deleteUrl you are trying to use the client-side value on the server . Remember <%: it will be called during server-side side rendering, so the identifier you set on the client side is not included in the game at all.
The option is to use the owner of the place, for example :
var deleteUrl = '<%:Url.ActionLink("Delete", "DeleteElementFromSet", new {id=%>Id<%})%>'; deleteUrl = deleteUrl.replace("##id##", Id); $("#Table").last() .append('<tr><td><a href=\"' + deleteUrl + '">Delete</a></td><td>'+Id+'</td></tr>');
eglasius Sep 24 '10 at 18:38 2010-09-24 18:38
source share