I am passing a controller ViewBag to the view and would like to pass it to a numeric array in JavaScript.
The content of the ViewBag:
"12,13,17,18,19,8,9,14"
My last attempt has been this:
var horas = @Html.Raw(Json.Encode(ViewBag.HorasBloquear));
var array = JSON.parse(horas);
when making the parse I get the error:
VM253: 1 Uncaught SyntaxError: Unexpected token, in JSON at position 2
Does anyone think of how to pass the ViewBag to a numeric array?