Is it a bad practice to pass data from the controller to the script?, ie:
<script>
@foreach (... in ViewBag.X) {
$.mynamespace.x[i] = ...
}
</script>
By "bypassing the view" I mean doing it this way:
<ul id="..." style="display:none;">
@foreach (... in ViewBag.X) {
<li id="...">...</li>
...
}
</ul>
And then in my script using selectors I could fill my $.mynamespace.x
array.