【发布时间】:2013-03-18 14:08:10
【问题描述】:
我想在 jqchart 中构建一个图表,我需要获取两个数组
现在我想执行下面给出的操作。这当然会出错。
html
$.ajax(
{
type: "GET",
url: "customer_coverage.php",
data: {id:id},
contentType: "application/json",
dataType: "json",
success: function (data21,data22) {
initChart2(data21,data22);
}
});
function initChart2(data21,data22) {
$('#jqChart2').jqChart({
series: [
{
type: 'column',
title: 'no of days ',
data:data21,
},
{
type: 'column',
title: 'no of days ',
data:data22,
},
]
});
}
这是 PHP 代码
echo json_encode($arr1);
echo json_encode($arr2);
那么有人知道怎么做吗?
【问题讨论】:
-
为什么不合并这两个数组,然后将它们编码为 JSON?