I'm having problems in binding a json data fetched from a php file to a grid. Here's what my php file looks like:
And here's the file where I have the grid:
$studs = array();
$db->query("SET CHARACTER SET utf8");
$students = $db->get_results("SELECT * FROM tbl_participants");
if(!empty($students)){
foreach($students as $k=>$v){
$studs['participant'][] = $v->participant;
}
}
echo json_encode($studs);
And here's the file where I have the grid:
<
script
>
$(document).ready(function() {
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "fetch_data.php",
dataType: "json"
}
},
schema: {data: "participant"}
});
$("#grid").kendoGrid({
dataSource: dataSource,
height: 360,
groupable: true,
scrollable: true,
sortable: true,
pageable: true,
autoBind:true,
columns: [
{field: 'participant', title: 'Name'}
]
});
});
</
script
>
<
table
id
=
"grid"
></
table
>