В дополнение к моему предыдущему вопросу я пытался использовать тот же рабочий код (для MVC2) в проекте MVC3. Я понял, что невозможно использовать метод jQuery.getJSON. Поэтому я попытался использовать методы $ .post и $ .ajax, но снова столкнулся с проблемой.
В обоих методах я получаю сообщение об ошибке «Jscript: JB пуст или не объект»
$.post("Home/GetLineData", null, function (items) {
var series = [];
jQuery.each(items, function (itemNo, item) {
//Get the items from the JSON and add then
//to the data array of the series
series.push({
name: item.Key,
data: item.Value
})
});
options.series = series;
chart = new Highcharts.Chart(options);
chart.render();
});
$.ajax({
type: "POST",
dataType: "json",
data: "{}",
contentType: "application/json; charset=utf-8",
url: "/Home/GetLineData",
cache: false,
succes: function (data) {
var series = [];
jQuery.each(data, function (itemNo, item) {
//Get the items from the JSON and add then
//to the data array of the series
series.push({
name: item.Key,
data: item.Value
})
});
options.series = series;
//Create the chart
chart = new Highcharts.Chart(options);
chart.render();
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(errorThrown);
}
});
Заранее спасибо за помощь (снова: -s).