I am new to web development. I am using jquery templates and they work fine. However, I have a markup code which has stuff like this among other things:
@Html.ActionLink("MyAction", "MyControllerAction", "MyController")
<div class="date">
Posted on : ${DatePosted}
<br />
Modified on: ${DateModified}
<br />
</div>
Now, the razor syntax above is of course not going to be interpreted correctly on client side. Is there any way to make razor syntax work in a jquery template? Any alternative way other than hard-coding the anchor? Does it even provide any benefit, using the html helper in the template?
Thanks!
Javascript does not read any razor syntax, it only reads plain HTML. Razor syntax is code executed on the server, before the resulting HTML is delivered to the browser. Javascript runs on the browser, after it has been delivered HTML content from the server. You are perfectly fine doing this:
By the time Javascript gets access to this block, it will look like this: