我有一个情况,我有一个下拉的PHP文件'A'.当我从该下拉列表中选择一个值时,进行ajax调用并触发不同的php文件B. 在那个文件中,我做数据库提取,并形成两个json对象.这两个json对象是我需要绘制2个不同的数据表和2个不同的图表.
当我在'B'中回应一个json对象时,我将其作为对'A'中ajax调用的响应
如果我在B中回显两个json对象,我甚至无法得到响应.
对于单个json对象响应,我可以绘制datatable并可以使用javascript操作json对象并希望绘制图表
请告知如何处理这种情况来自文件B的代码
$json = json_encode($tot_categ);
$json_percent = json_encode($tot_que_percent);
$cols_percent = array(
array( 'id' => 't', 'label' => 'Title', 'type' => 'string'),
array( 'id' => 'n', 'label' => 'Neutral(+) ', 'type' => 'string'),
array('id' => 'a', 'label' => 'Agree', 'type' => 'string'),
array('id' => 'ne', 'label' => 'Neutral(-)', 'type' => 'string'),
array('id' => 'd', 'label' => 'Disagree', 'type' => 'string'),
);
$jcols_percent = json_encode($cols_percent);
//JSON format accepted by Google tables
$r_percent= "{cols:".$jcols_percent.','."rows:".$json_percent."}";
//echo (JSON.stringify($r_percent));
// echo $r_percent; …Run Code Online (Sandbox Code Playgroud)