I have a dynamic table generated in JS which appends a button (and image) in one of the columns of the table:
var btn = $("<button/>", { class: "btn btn-default dropdown-toggle options_btn_custom", }).prepend('<img src="@Url.Content("~/Content/img/Settings.png")" />');
The issue is the Razor image URL within the HTML is rendered incorrectly:
The URL of the image has to be relative (hence the Razor)...
I know its possible to embed Razor within JS directly, but is there a way for it to work also within embedded HTML, or is it too far a long shot?

var img = '@Url.Content(...);and access from the external file(or if you handling an event of an element, add adata-*attribute)