I am using the following in my _layout.cshtml
<div id="authorLoader" data-request-url="@Url.Action("Index", "Author", new { area = "Book" })"></div>
In js file, I retrieve the url as so:
var url= $('#authorLoader').data('request-url');
Works fine, however, I end up having 20+ div tags in my layout page. Is there a better way to pass url strings to javascript? Or is this recommended way?
Thanks!