1

My Code:

<script type="text/javascript">
    var root = @Url.Content("~/Content/");
</script>

This has no effect.

<script type="text/javascript">
    var root = '@Url.Content("~/Content/WebApp/img/")';
</script>

Solution.

1
  • var root = '@Url.Content("~/Content/WebApp/img/")'; This works now... crazy. :) Commented Apr 5, 2011 at 18:15

1 Answer 1

2

The first code sample is missing a pair of single or double quotes. The second one is ok. It works for me.

Or what do you mean by "This has no effect."? Have you looked at the generated HTML code? What do you get?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.