私の以前のquestionに加えて、私はMVC3プロジェクトで同じ作業コード(MVC2用)を使用しようとしました。私は、jQuery.getJSONメソッドを使用することができないことを理解しました。ですから、代わりに$ .postと$ .ajaxメソッドを使用しようとしましたが、もう一度問題に直面しました。asp.net mvc 3 highchart
私はエラーを取得両方の方法で「の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)。
が、あなたの 'SUCCESS'コールバックが綴られています違う。あなたは末尾の "s"がありません –
ありがとうございました。確かに私は逃した。これで、$ .postメソッドと同じエラーが発生しました。しかしそれは一貫している;) – Jorelie