I'm receiving this kind of error on my script any idea how to debug this? I tried a few solutions like the latest script should be at the top
$(document).ready(function () {
$.ajax({
type: "POST",
url: 'Home/DashBoardcount',
data: JSON.stringify({}),
contentType: "application/json:charset=utf-8",
dataType: "json",
success: function (json) {
var values = json.DashBoardcount;
var passcount = parseInt(values[0]);
var failcount = parseInt(values[1]);
}
})
});
Highcharts.chart('container', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: 'Browser market shares in May, 2020'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
accessibility: {
point: {
valueSuffix: '%'
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
}
}
},
series: [{
name: 'Brands',
colorByPoint: true,
data: [{
name: 'Chrome',
y: 70.67,
sliced: true,
selected: true
}, {
name: 'Edge',
y: 14.77
}, {
name: 'Firefox',
y: 4.86
}, {
name: 'Safari',
y: 2.63
}, {
name: 'Internet Explorer',
y: 1.53
}, {
name: 'Opera',
y: 1.40
}, {
name: 'Sogou Explorer',
y: 0.84
}, {
name: 'QQ',
y: 0.51
}, {
name: 'Other',
y: 2.6
}]
}]
});
View ( Charts):
@{
ViewBag.Title = "Charts";
}
<script src="~/Scripts/Dashboard charts/Dashboard.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
Pie charts are very popular for showing a compact overview of a
composition or comparison. While they can be harder to read than
column charts, they remain a popular choice for small datasets.
</p>
</figure>
Controller:
public ActionResult Charts()
{
return View();
}
public JsonResult DashBoardcount()
{
try
{
string[] DashBoardcount = new string[2];
SqlConnection con = new SqlConnection(connectionString);
con.Open();
SqlCommand cmd = new SqlCommand("Select count([YearGraduate]) as pass,(select count([YearGraduate]) from [dbo].[Student] where YearGraduate='2022'and Program='CE' and BoardScore >=60.00) as fail from [dbo].[Student] where YearGraduate='2022' and Program='CE' and BoardScore <=59.99", con);
DataTable dt = new DataTable();
SqlDataAdapter cmd1 = new SqlDataAdapter(cmd);
cmd1.Fill(dt);
if(dt.Rows.Count == 0)
{
DashBoardcount[0] = "0";
DashBoardcount[1] = "0";
}
else
{
DashBoardcount[0] = dt.Rows[0]["pass"].ToString();
DashBoardcount[1] = dt.Rows[0]["fail"].ToString();
}
return Json(new { DashBoardcount }, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
throw ex;
}
}
}
}