there seems to be a problem when I echo json string in the
dataTableViewDaily.php file as the JSON string seems to be correct, so this
is a small part of the code I have:
$jsonObj = json_encode($table);
header('Cache-Control: no-cache, must-revalidate');
header('Content-type: application/json');
echo $jsonObj;
On 11 August 2013 21:19, Razee Hussein-Jamal <[email protected]> wrote:
> Yes, I have the google.load inside the script.
>
> This is the error I receive: Error: Invalid JSON string: error: 1046
>
> And this is the JSON string that is echo inside the dataTableViewDaily.php
>
> {"cols":[{"id":"A","label":"Date","type":"string"},{"id":"B","label":"User","type":"string"},{"id":"C","label":"Cement
> Brand","type":"string"},{"id":"D","label":"Volume","type":"string"},{"id":"E","label":"Type","type":"string"}],"rows":[{"c":[{"v":"08-06-2013"},{"v":"
> [email protected]"},{"v":"Muthana"},{"v":"27"},{"v":"Local
> Plant"}]},{"c":[{"v":"08-06-2013"},{"v":"[email protected]"},{"v":"Samawa"},{"v":"28"},{"v":"Local
> Plant"}]}]}
>
> Thank you
>
>
> On 11 August 2013 19:23, asgallant <[email protected]> wrote:
>
>> You might just have left it out of the post, but your code is missing the
>> google.load call that loads the Visualization API, so make sure you have
>> that. If that's not the problem, post a copy of the JSON output by the
>> "dataTableViewDaily.php" script so I can verify that it is in the correct
>> format. Also, open the page in Chrome or Firefox and check the developer's
>> console to see if there are any error messages displayed.
>>
>>
>> On Sunday, August 11, 2013 6:22:26 AM UTC-4, Razee Hussein-Jamal wrote:
>>>
>>> Currently developing a website where I query data from a mysql database
>>> and encode it to JSON string, I want to view the data using the google
>>> charts and tables.
>>>
>>> At the moment I can't view the data in the tables but the JSON string
>>> output seems to be correct.
>>>
>>> Here is the javascript code:
>>>
>>> <script type="text/javascript">
>>> function drawVisualization() {
>>>
>>> var jsonData = $.ajax({
>>> url: "dataTableViewDaily.php", // make this url point to the
>>> data file
>>> dataType: "json",
>>> async: false
>>> }).responseText;
>>> var data = new google.visualization.**DataTable(jsonData);
>>>
>>>
>>> // Create and draw the visualization.
>>> visualization = new google.visualization.Table(**
>>> document.getElementById('**table'));
>>> visualization.draw(data, null);
>>> }
>>>
>>>
>>> google.setOnLoadCallback(**drawVisualization);
>>> </script>
>>>
>>> dataTableViewDaily.php echo the json string.
>>>
>>> Would appreciate any help, thank you
>>>
>>>
>>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Google Visualization API" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/google-visualization-api/fiy-6Llj_6A/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To post to this group, send email to
>> [email protected].
>> Visit this group at
>> http://groups.google.com/group/google-visualization-api.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
>
> --
> Razee Hussein-Jamal
> Masters in Embedded Systems,
> Department of Information Technology,
> Uppsala University - Sweden
> Mobile Phone : +46764158553 (Sweden) , +9647701524721 (N.Iraq),
> +905058622477 (Turkey)
>
>
--
Razee Hussein-Jamal
Masters in Embedded Systems,
Department of Information Technology,
Uppsala University - Sweden
Mobile Phone : +46764158553 (Sweden) , +9647701524721 (N.Iraq),
+905058622477 (Turkey)
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.