I have a Jquery Function which generates reports like bar chart, line chart etc.
I used ajax in Jquery, to make a call to php function which returns a Json object. The problem is, I have to return the complete data from all the columns in a table. With ajax, i have successfully returned all the values in a single column to my Jquery function . But, i am unable to return multiple columns. Please Help me.
//Ajax function calling
$.ajax({
url: 'Data.php', //the script to call to get data
data: "", //you can insert url argumnets here to pas
//for example "id=5&parent=6"
dataType: 'json',
async: false,//data format
success: function(data) //on recieve of reply
{
var returnedArray = [];
returnedArray = data;
}
});
///// Data.php code
<?php
$host = "localhost";
$user = "root";
$pass = "";
$databaseName = "edb";
$tableName = "user";
$con = mysql_connect($host,$user,$pass);
$dbs = mysql_select_db($databaseName, $con);
$i=0;
$storeArray= Array();
$result = mysql_query("SELECT User_Id FROM user");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$storeArray[$i] = $row['User_Id'];
$i++;
}
echo json_encode($newstoreArray);
?>
In the above Data.php, i have successfully returned values of a single column "User_Id" values. I want to return more Columns.