how to read a .json file in google api,,,
iam not able to read a file,, please guide me fast...
the below is the code
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', { packages: ['table'] });
</script>
<script type="text/javascript">
function drawVisualization() {
var JSONObject = JSONObject.setJSONUrl("data.json"); ;
var data = new google.visualization.DataTable(JSONObject, 0.5);
visualization = new google.visualization.Table(document.getElementById('table'));
visualization.draw(data, { 'allowHtml': true });
}
google.setOnLoadCallback(drawVisualization);
</script>
and the json data in file is :
{cols: [{ id: 'task', label: 'Task', type: 'string' },{ id: 'hours', label: 'Hours per Day', type: 'number'}],rows: [{ c: [{ v: 'Work', p: { 'style': 'border: 7px solid orange;'} }, { v: 11}] },{c: [{ v: 'Eat' }, { v: 2}] },{ c: [{ v: 'Commute' }, { v: 2, f: '2.000'}]}] }