views:

114

answers:

1

I'm trying experiment with DabbleDB to see if it's something that I could use to store data in. They have a JavaScript API that's based on JSON (http://dabbledb.com/help/guides/jsapi/). I've never used JSON before and have been trying to understand how to use it.

The above link has their APIs file (which I downloaded and called "json-api.js since that seemed to be what they used in their examples). Additionally, I downloaded a schema file from my test database (which just has 1 table called Events, with 1 record). I called this file neotest-schema.js. I then got an export link of the table from their Web site which is: http://neotest.dabbledb.com/publish/neotest/67249c55-1839-4908-9e1a-366ca2f9192c/events.jsonp

I tried to follow their examples, but they don't explain how to actually use the "url" to get data, so I figure I'm missing something. I guess the first question then is: How do you retrieve data into JSON via a URL?

My poor attempt went something like this:

<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>New Web Project</title>
</head>
<body>
    <h1>New Web Project Page</h1>

 <script src="json-api.js" language="javascript"></script>
 <script src="neotest-schema.js" language="javascript"></script>
 <script src="http://neotest.dabbledb.com/publish/neotest/67249c55-1839-4908-9e1a-366ca2f9192c/events.jsonp" type="text/javascript"></script>

 <br>Table Begin<br>
 <script type="text/javascript">Dabble.view('Events').writeTable()</script>
 <br>Table End<br>


</body>

Which did nothing for the "Dabble.view" tag. The Begin and End tags showed up, but nothing else happen. If there's a good way I can go about debugging this, I'm fine with those kind of instructions too. I'm using Eclipse with the Aptana plugin and my project include JQuery and Dojo if those would be helpful in solving my problem.

A: 

Instead of using the DabbleDB provided JSON Apis, I've been able to use JQuery to pull the data (sample code without reading the schema)

     <script type="text/javascript">   
  $.getJSON("http://neotest.dabbledb.com/publish/neotest/67249c55-1839-4908-9e1a-366ca2f9192c/events.jsonp?callback=?",
        function(data){
          $.each(data.entries, function(i,entry){
     $("#dataStuff").append(entry.fields[0].value);
          });
        });
 </script>  

 <div id="dataStuff"></div>

I'm still trying to get the DabbleDB stuff working however.

Kivus