Javascript 使用ajax为highcharts添加自定义参数
我正在尝试向我的highcharts中添加一些参数,这些参数由ajax调用。我在一个单独的php中调用所有必要的参数,然后成功的结果将把它放入highcharts的容器中 我的代码:Javascript 使用ajax为highcharts添加自定义参数,javascript,php,jquery,ajax,highcharts,Javascript,Php,Jquery,Ajax,Highcharts,我正在尝试向我的highcharts中添加一些参数,这些参数由ajax调用。我在一个单独的php中调用所有必要的参数,然后成功的结果将把它放入highcharts的容器中 我的代码: $.ajax({ type: 'post', url: 'sdayresult.php', data: $("#FormName").serialize(), success: function(data) { //$("#anser").htm
$.ajax({
type: 'post',
url: 'sdayresult.php',
data: $("#FormName").serialize(),
success: function(data) {
//$("#anser").html(data);
$('#container').highcharts({data});
}
数据的价值:
chart: {
type: 'scatter'
},
title: {
text: 'Search by Airline'
},
xAxis: {
categories: ['none']
},
yAxis: {
title: {
text: '# of Crew'
}
},
series: [{
name: '# of Crew',
URLs: ['#'],
data: [0],
point: {
events: {
click: function() {
var someURL = this.series.userOptions.URLs[this.x]; // onclick get the x index and use it to find the URL
if (someURL)
window.open('http://'+someURL);
}}}
}]
但是当我运行脚本时,出现了一个javascript错误,表示我有一个未定义的“}”。我尝试将数据的值粘贴到highcharts的另一个测试页面上,看起来数据的值是正确的。我应该怎么做才能修复它?您是否包含了所有必需的highcharts js库…?如果您有额外的
}
请删除它。你刚才在JS中有错误,仅此而已。