0 Replies Latest reply on Dec 22, 2014 5:56 AM by bganesh2011

    Importing data from Google Fusion Tables API

    bganesh2011

      Hi all,

       

      I am working on a simple animation at the moment to practice getting data from Google Fusion Tables. The basic flow of what I am doing is:

      1. Create URL for query to google fusion tables
      2. Pass URL into $.ajax({...
      3. Create a symbol of each row in the table in edge animate

       

      Since I'm just practicing I really don't care how it looks, that's the next step. I have this script in an HTML that works to load the data:

       

         var query = 'SELECT label, postcode FROM' + ' ' + '1jtaKPcmAKQRb1mI6B7LNUX9clY-nf8dHdj_czx-n';
         var encodedQuery = encodeURIComponent(query);
         //Construct the URL
         var url = ['https://www.googleapis.com/fusiontables/v1/query' + '?sql=' + encodedQuery + '&key=MYAPIKEY'];
         console.log(url);

       

         $.ajax({
         url : url,
         dataType : 'jsonp',
         success : function(data) {
         var rows = data['rows'];
         for (var i in rows) {
         label = rows[i][0];
         console.log(label);  
         }
         }
         });

       

      When I do this, and check my console, everything works perfectly; I have a list of the 'label' column that I am after from the dataset (a list of mosques that have been attacked in the UK, I am a hate crime researcher).

       

      When I put the exact same code into Edge Animate and it CMD + Enter to preview, I get a weird error: "Javascript error in event handler! Event Type = symbol" and the console doesn't have any of the information than it does in the standalone HTML that I created myself (without Edge). Until I get past this step and can see the data logged in the console I can't move on to animating the symbols, etc.

       

      Can someone help me figure out what's wrong? I've looked at a lot of help videos (for example on using the Twitter API in edge animate) and they haven't helped me get past this problem. Any assistance would be much appreciated, and since there's no information on Edge Animate and Google Fusion Tables API specifically I think this would be pretty useful.

       

      Thanks!