【发布时间】:2018-04-27 22:29:03
【问题描述】:
我进行了一个 Ajax 调用,需要返回(成功后:...)一个表示 SQL 查询的多维数组:
$.ajax({ url: 'http://localhost/Project/ajaxmethod.php',
data: {action: this.title},
type: 'post',
success: function(data) {
//I need to use the data array here.
});
这里是被调用的方法:
<?php
$bdd = new PDO('mysql:host=localhost;dbname=DATABASE;charset=utf8', 'root', '');
$req = $bdd->query("SELECT column1, column2, column3 FROM TABLE ");
$data = ... //Here I need to transform the previous request into a multidimensional array.
//For exemple data[3][2] will contain the value within the third row of the second column
echo $data; //returning the array
}
谢谢
【问题讨论】: