Example 7 : Query : Using Google Visualization API clear | view source | main page | next example
Queries to your databases are made by referencing the queries that you developed on the NextDB admin pages. For obvious security reasons, the query language syntax is not exposed at the JavaScript level. Executing SQL from the browser would pose obvious security problems. Rather, you reference a query by its name. The query request is sent asynchronously to the server, and your callback function handles the response-- standard AJAX programming. Behind the scenes we are using we using a communication mechanism that side steps the 'server of origin' policy of the XMLHTTPRequest. So you can access NextDB from a page loaded from a server different than www.nextdb.net. This enables mashups in the true sense of the word. In this example the query named "QUERY1" is being executed and an anonymous inline callback function is handling the returned data.

This example is using the Google Visualization API to visualize the JSON results in a table structure. Since nextDB is a framework neutral API is plays nicely with any third party JavaScript Tools.