I need to convert data from my model that is available as an C# array to a Javascript array.
I tried JavaScriptserializer and other methods I found
but nothing worked so far. Maybe I got some kind of syntax error.
My site also uses Razor Viewengine. I don'T know if that may cause the problem.
Currently I use this
<script type="text/javascript">
$(function() {
var Orte = [@string.Join(",",Model.HaltestellenListe.Select(x=>"'"+x+"'"))];
the result of this line looks like this
var Orte = [&#39;Abbingwehr, Mast 1&#39;,&#39;Abelitz, B210/Abzw. Gr. Meer,&#39;]
Thats not what I need.
I need it to be a javascript array:
var Orte = ['Abbingwehr, Mast', 'Abelitz, B210/Abzw. Gr. Meer']