in js variable i am trying to store image url using razon syntax but getting error. here is my sample code.
$(document).ready(function () {
var loader = '@Url.Content("~/images/loader.gif")';
});
i follow this post https://stackoverflow.com/a/21486213/728750 https://stackoverflow.com/a/29798960/728750
but i follow the same syntax but in my case i am getting error. my js code is in separate file....not in view file.
looking for suggestion. thanks
EDIT
i have this code in my main view at top.
<script>
var loaderUrl
$(document).ready(function () {
var loaderUrl = '@Url.Content("~/images/loader.gif")';
alert(loaderUrl);
});
</script>
later i try to access this variable loaderUrl in external js file which is loading at bottom of my main view......but still no luck.