I study mvc. I am writing using the javascripta function on the page and trying to embed c # code there. This is what happens:
@section scripts { <script> var arr = @JsonConvert.SerializeObject(@ViewData["pieData"] as List<PieSeriesData>); var timeReload = 3; var timenow = 0; function isReload() { timenow++; if (timenow >= timeReload) { timenow = 0; } setInterval("isReload()", 1000); </script> } Uncaught SyntaxError: Unexpected token &
var arr = [{"ClassName": "", "Color": "undefined", "ColorIndex": null, "DataLabels": {"BackgroundColor": "", "BorderColor": "undefined", "BorderRadius": 0.0, "BorderWidth": 0.0, "ClassName": "", "Color": "", "ConnectorColor": "{point.color}", "ConnectorPadding": 5.0, "ConnectorWidth": 1.0, "Crop": true, "Defer": true, "Distance": 30.0, "Enabled": true, "Filter": {"Operator": "", "Property": "", "Value": null}, "Format": "", "Formatter": "", "Inside": null, "Overflow": 0, "Padding": "5", "Rotation": 0.0, "Shadow": {"Enabled": false, "Color" : "", "OffsetX": 0, "OffsetY": 0, "Opacity": 0.0, "Width": 0}, "ShadowBool": null, "Shape": "square", "SoftConnector": null, " Style ": {" Color ":" contrast "," FontSize ":" 11px "," FontWeight ":" bold "," TextOutline ":" 1px contrast "}," UseHTML ": false," VerticalAlign ": 2, "X": 0.0, "Y": - 6.0, "ZIndex": 6.0}, "Description": "undefined", "Drilldown": "", "Events": {"Click": "", "MouseOut" : "", "MouseOver": "", "Remove": "", "Select": "", "Unselect": "", "Update": ""}, "Id": "null", "Labelrank ": null," LegendIndex ": null," Name ":" FireFox "," Selected ": false," Sliced ββ": null," Y ": 45.0," CustomFields ": {}}, {" ClassName ":" "," Color ":" undefined "," ColorIndex ": null," DataLabels ": {" BackgroundColor ":" "," BorderColor ": "undefined", "BorderRadius": 0.0, "BorderWidth": 0.0, "ClassName": "", "Color": "", "ConnectorColor": "{point.color}", "ConnectorPadding": 5.0, "ConnectorWidth ": 1.0," Crop ": true," Defer ": true," Distance ": 30.0," Enabled ": true," Filter ": {" Operator ":" "," Property ":" "," Value " : null}, "Format": "", "Formatter": "", "Inside": null, "Overflow": 0, "Padding": "5", "Rotation": 0.0, "Shadow": {" Enabled ": false," Color ":" "," OffsetX ": 0," OffsetY ": 0," Opacity ": 0.0," Width ": 0}," ShadowBool ββ": null," Shape ":" square " , "SoftConnector": null, "Style": {"Color": "contrast", "FontSize": "11px", "FontWeight": "bold", "TextOutline": "1px contrast"}, "UseHTML": false, "VerticalAlign": 2, "X": 0.0, "Y": - 6.0, "ZIndex": 6.0}, "Description": "undefined", "Drilldown": "", "Events": {"Click ":" "," MouseOut ":" "," MouseOver ":" "," Remove ":" "," Select ":" "," Unselect ":" "," Update ":" "}," Id ":" null "," Labelrank ": null," LegendIndex ": null," Name ":" IE "," Selected ": false," Slice d ": null," Y ": 26.8," CustomFields ": {}}, {" ClassName ":" "," Color ":" undefined "," ColorIndex ": null," DataLabels ": {" BackgroundColor ": "", "BorderColor": "undefined", "BorderRadius": 0.0, "BorderWidth": 0.0, "ClassName": "", "Color": "", "ConnectorColor": "{point.color}", " ConnectorPadding ": 5.0," ConnectorWidth ": 1.0," Crop ": true," Defer ": true," Distance ": 30.0," Enabled ": true," Filter ": {" Operator ":" "," Property " : "", "Value": null}, "Format": "", "Formatter": "", "Inside": null, "Overflow": 0, "Padding": "5", "Rotation": 0.0 , "Shadow": {"Enabled": false, "Color": "", "OffsetX": 0, "OffsetY": 0, "Opacity": 0.0, "Width": 0}, "ShadowBool": null, "Shape": "square", "SoftConnector": null, "Style": {"Color": "contrast", "FontSize": "11px", "FontWeight": "bold", "TextOutline": "1px contrast "}," UseHTML ": false," VerticalAlign ": 2," X ": 0.0," Y ": - 6.0," ZIndex ": 6.0}," Description ":" undefined "," Drilldown ":" ", "Events": {"Click": "", "MouseOut": "", "MouseOver": "", "Remove": "", "Select": "", "Unselect": "", "Update" : ""}, "Id": "null", "Labelrank": null, "LegendIndex": null, "Name": "Chrome", "Selected ": true," Sliced ββ": true," Y ": 12.8," CustomFields ": {}}, {" ClassName ":" "," Color ":" undefined "," ColorIndex ": null," DataLabels ": {"BackgroundColor": "", "BorderColor": "undefined", "BorderRadius": 0.0, "BorderWidth": 0.0, "ClassName": "", "Color": "", "ConnectorColor": "{point. color} "," ConnectorPadding ": 5.0," ConnectorWidth ": 1.0," Crop ": true," Defer ": true," Distance ": 30.0," Enabled ": true," Filter ": {" Operator ":" "," Property ":" "," Value ": null}," Format ":" "," Formatter ":" "," Inside ": null," Overflow ": 0," Padding ":" 5 ", "Rotation": 0.0, "Shadow": {"Enabled": false, "Color": "", "OffsetX": 0, "OffsetY": 0, "Opacity": 0.0, "Width": 0}, " ShadowBool ββ": null," Shape ":" square "," SoftConnector ": null," Style ": {" Color ":" contrast "," FontSize ":" 11px "," FontWeight ":" bold "," TextOutline ":" 1px contrast "}," UseHTML ": false," VerticalAlign ": 2," X ": 0.0," Y ": - 6.0," ZIndex ": 6.0}," Description ":" undefined "," Drilldown ":" "," Events ": {" Click ":" "," MouseOut ":" "," MouseOver ":" "," Remove ":" "," Select ":" "," Unselect ":" "," Update ":" "}," Id ":" null "," Labelrank ": null," LegendIndex ": null," Name ":" Safa ri "," Selected ": false," Sliced ββ": null," Y ": 8.5," CustomFields ": {}}, {" ClassName ":" "," Color ":" undefined "," ColorIndex ": null , "DataLabels": {"BackgroundColor": "", "BorderColor": "undefined", "BorderRadius": 0.0, "BorderWidth": 0.0, "ClassName": "", "Color": "", "ConnectorColor" : "{point.color}", "ConnectorPadding": 5.0, "ConnectorWidth": 1.0, "Crop": true, "Defer": true, "Distance": 30.0, "Enabled": true, "Filter": { "Operator": "", "Property": "", "Value": null}, "Format": "", "Formatter": "", "Inside": null, "Overflow": 0, "Padding" : "5", "Rotation": 0.0, "Shadow": {"Enabled": false, "Color": "", "OffsetX": 0, "OffsetY": 0, "Opacity": 0.0, "Width" : 0}, "ShadowBool": null, "Shape": "square", "SoftConnector": null, "Style": {"Color": "contrast", "FontSize": "11px", "FontWeight": " bold "," TextOutline ":" 1px contrast "}," UseHTML ": false," VerticalAlign ": 2," X ": 0.0," Y ": - 6.0," ZIndex ": 6.0}," Description ":" undefined "," Drilldown ":" "," Events ": {" Click ":" "," MouseOut ":" "," MouseOver ":" "," Remove ":" "," Select ":" ", "Unselect": "", "Update": ""}, "Id": "null", "Labelrank": null, "LegendIndex": null , "Name": "Opera", "Selected": false, "Sliced": null, "Y": 6.2, "CustomFields": {}}, {"ClassName": "", "Color": "undefined" , "ColorIndex": null, "DataLabels": {"BackgroundColor": "", "BorderColor": "undefined", "BorderRadius": 0.0, "BorderWidth": 0.0, "ClassName": "", "Color": "", "ConnectorColor": "{point.color}", "ConnectorPadding": 5.0, "ConnectorWidth": 1.0, "Crop": true, "Defer": true, "Distance": 30.0, "Enabled": true , "Filter": {"Operator": "", "Property": "", "Value": null}, "Format": "", "Formatter": "", "Inside": null, "Overflow" : 0, "Padding": "5", "Rotation": 0.0, "Shadow": {"Enabled": false, "Color": "", "OffsetX": 0, "OffsetY": 0, "Opacity" : 0.0, "Width": 0}, "ShadowBool": null, "Shape": "square", "SoftConnector": null, "Style": {"Color": "contrast", "FontSize": "11px" , "FontWeight": "bold", "TextOutline": "1px contrast"}, "UseHTML": false, "VerticalAlign": 2, "X": 0.0, "Y": - 6.0, "ZIndex": 6.0} , "Description": "undefined", "Drilldown": "", "Events": {"Click": "", "MouseOut": "", "MouseOver": "", "Remove": "", " Select ":" "," Unselect ":" "," Update ":" "}," Id ":" null "," Labelrank ": null," Legen dIndex ": null," Name ":" Others "," Selected ": false," Sliced ββ": null," Y ": 0.7," CustomFields ": {}}];