I am trying to pass data from the ViewBag object to javascript on my view.
//In the controller
ViewBag.SomeUrl = "http://mydomain.com";
//In the View
<script type="text/javascript">
var theUrl = " @ViewBag.SomeUrl + ";
</script>
The problem I am having is that the following example sets the js var "theUrl" to:
" + http://mydomain.com + "
Omitting the concatenated quotes causes javascript to bark about the colons obviously. So how can I pass this url as a sting to my javascript var?
Thanks!