When you have some JavaScript on an MVC razor view is it possible to do a model variable replacement in the middle of a multipart statement.
To clarify I have the code
<script>
function drawChart() {
$.post('@Url.Content("~/Home/GetDataAssets")', function (d) {
...
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
});
};
where I want the type of graph that is displayed to come from the model. So the chart line would have to look something like
var chart = new [email protected](document.getElementById('chart_div'));
Where LineChart
has been replaced by @Model.ChartType
This obviously gives the error
ChartType is being used like a method
Is there a way to make this substitution?