I'm using ASP.NET MVC (with Razor) and JQuery
I have a list of strings in my controller and I render the partial view passing in the model with the below list.
List<string> list = new List<string>();
list.Add("test1");
list.Add("test2");
On client side I have:
<div id = "test", test-att = @Html.Raw(Json.Encode(Model.list)) />
In my javascript file I do:
var javascriptArray = $('#test').attr('test-att');
I'm expecting a result ["test1", "test2"] but I'm seeing "["test1", "test2"]"
Any ideas on how to fix this?