I am currently building a website in ASP.NET MVC. I am trying to access ViewData in javascript.
Is there any way that I can access a string value using javascript in a View that was stored in ViewData in a Controller Action. ( I am not able to figure out the right syntax ).
I wish to do something like..
var str = ViewData["Text"];
I tried the following:
var str = <%=ViewData["Text"] %>
but it didn't work.
Can someone please help.
Thanks.