I do a mistake in my last post! The server part send the string:
myHandler({"version":"0.5","reqId":"1","status":"ok","table":{"cols":
[... )
And when, in the client part (JavaScript in the Interner browse) calls
my initialize function with the following code:
var query = new google.visualization.Query('http://localhost:8080/
grailsbox/visualization/data?responseHandler=myHandler');
query.send(null);
my myHandler JavaScript function is well called and the graph is well
displayed on the page!
To repeat the problem I got:
But I remark that a JavaScript error is generated after 30 seconds. I
understood that it's because I
use null in the query.send: the API tries to call an handler.
If I use an handler: query.send(myHandler1); with myHandler1 defined
like this
function myHandler1(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
return;
}
}
I see an error message telling "Request timed out".
What I missed? The documentation seems to say to use the Query's get
method, but it is not defined.
Thank you for any help!
Cheers,
Bertrand
http://www.odelia-technologies.com/
On 17 nov, 18:21, bgoetzmann <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I've implemented a custom data source using the powerful Grails
> framework; here how I use this source in the HTML page:
>
> ...
> google.setOnLoadCallback(initialize);
> function initialize() {
> var query = new google.visualization.Query('http://localhost:8080/
> grailsbox/visualization/data?responseHandler=myHandler');
> query.send(null);}
>
> function myHandler(response) {
> // Tester response.status
> var dt = new google.visualization.DataTable(response.table,
> response.version);
> var chart = new google.visualization.PieChart
> (document.getElementById('chart_div'));
> chart.draw(dt, {width: 400, height: 240, is3D: true});}
>
> ...
>
> The URL is used to fetch JSON data (using a Grails controller action):
>
> {"version":"0.5","reqId":"1","status":"ok","table":{"cols":[...
>
> All is OK: the graph is displayed! But I remark that a JavaScript
> error is generated after 30 seconds. I understood that it's because I
> use null in the query.send: the API tries to call an handler.
> If I use an handler: query.send(myHandler1); with myHandler1 defined
> like this
>
> function myHandler1(response) {
> if (response.isError()) {
> alert('Error in query: ' + response.getMessage() + ' ' +
> response.getDetailedMessage());
> return;
> }
>
> }
>
> I see an error message telling "Request timed out".
>
> What I missed? The documentation seems to say to use the Query's get
> method, but it is not defined.
>
> Thank you for any help!
>
> Cheers,
>
> Bertrandhttp://www.odelia-technologies.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en
-~----------~----~----~----~------~----~------~--~---