I have a strongly typed view to a CalculateModel where a user puts some information and make a ajax post to the controller, the controller executes some maths in this data and return a PartialView strongly typed to the ResultCalculateModel.
In the Result partial view, i have a d3 chart which is dynamically generated with some parameters that i have in the ResultCalculateModel. Heres some code:
@model DTO.CalculateModel
//the html helpers here to user input some data
<div id='divOutPutData'> </div>
<script>
function getResult() {
$.post("/GetResult", $('#form01').serialize())
.success(function (result) {
$('#divInputData').attr('style', 'display:none');
$('#divOutPutData').append(result);
};
function drawChart(s,p,c){
//code
};
</script>
The action:
public ActionResult GetResult(CalculateModel model)
{
ResultCalculateModel result = _calculateResult.Calculate(model);
return PartialView("Result", result);
}
The result Partial View:
@model DTO.ResultCalculateModel //the parameters of the drawChart function are in this model.
//some Razor Helpers which is working
<div id="chartResult"> </div> //i need to display the chart here
I would like to know how i can execute the drawChart function in partial view rendering?