Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7577501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:12:05+00:00 2026-05-30T17:12:05+00:00

My website is called Earthquake Damage Map . I am trying to make a

  • 0

My website is called Earthquake Damage Map. I am trying to make a search box autocomplete with a list of possible results from the column in the fusion table. This is a good example, however I find it difficult to match it to my own as I now have my queries joined by AND. This is my university project and any help would be appreciated. How do I edit the following code to allow this?

searchString = document.getElementById('search-string4').value; 
if(searchString){
   query.push("'Earthquake' CONTAINS '" + searchString + "'"); }

<div style="margin-top: 10px;"> 
  <label>Earthquake Name:</label><br />
  <input type="text" id="search-string4" /> 
  <input type="button" onclick="doQuery();" value="Search" /> 
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:12:06+00:00Added an answer on May 30, 2026 at 5:12 pm

    Part of your solution will involve getting from your Fusion Table a unique list of values from your Earthquake column. This can be done via FT’s undocumented JSONP API. Then you can use jqueryui Auto Complete methods on your text input. Here’s the code. Sorry it’s a bit long but it’s a complete file which should run in your browser.

    <html>
    <head>
    <title>Fusion Tables JSONP</title>
    
    <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> 
    
    <script type="text/javascript">
    var tableid = 2951949;
    
    //////////////////////////////
    // SELECT DISTINCT need to GROUP BY col_name and add COUNT() operator.  2 columns will be returned distinct colname and count.
    //////////////////////////////
    function getFTDistinct(table_id, col_name, where, successFunction) {
    
        var queryUrlHead = 'https://fusiontables.googleusercontent.com/fusiontables/api/query?sql=';
        var queryUrlTail = '&jsonCallback=?';
    
        var query = "SELECT " + col_name + ", COUNT() FROM " + table_id;
        if(!where){
            query += " GROUP BY " + col_name;
        }else{
            query += ' ' + where + " GROUP BY " + col_name;
        }
        var queryurl = encodeURI(queryUrlHead + query + queryUrlTail);
    
        $.ajax({
            type: "GET",
            url:  queryurl,
            dataType: "jsonp",  // returns CSV FustionTable response as JSON
            success: successFunction,
            error: function () {alert("AJAX ERROR for " + queryurl ); }
        });
    
    }
    
    function example_dataHandler(d) {
        // get the actual data out of the JSON object
        var cols = d.table.cols;
        var rows = d.table.rows;
        var row_count = 0;
        var results = '<table border="1" cellpadding="4">';
        results += '<tr>';
        for (var i = 0; i < cols.length; i++) {
            results += '<th>' + cols[i] + '</th>';
        }
        results += '</tr>';
        for (var i = 0; i < rows.length; i++) {
    
            results += '<tr>';
            for(j=0; j < rows[i].length; j++)
            {
                results += '<td>' +  rows[i][j] + '</td>';
            }
            results += '</tr>';
            row_count++;
        }
        results += '</table>';
        results += '<br />';
    
        results += 'Row Count: ' + row_count + '<br />';;
    
        $("#results").text('');
        $("#results").append(results);
    }
    
    function distinctTest()
    { 
       getFTDistinct(tableid, 'Earthquake', '', example_dataHandler);
    }
    
    </script>
    
    </head>
    <body>
    <br />
    <input type="button" value="DISTINCT Earthquake" onClick="distinctTest();">
    <br />
    <div id="results"></div>
    </body>
    </html>
    

    enter code here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get the API from a website called zillow working for
I've developed a series of classes that are called from an asp.net website to
i have to retrieve some text from a website called morningstar.com . To access
there is this awesome website called www.engrade.com. You can get your grades from the
Say I have a file in my kohana 3 website called assets/somefile.jpg . I
I have a parent table called 'Website' which holds records about websites. I have
EDIT: Purpose of this Website: Its called Utopiapimp.com. It is a third party utility
My dad called me today and said people going to his website were getting
My website has a setup whereby when the application starts a module called SiteContent
the tigris website http://subversion.tigris.org/getting.html#windows has a link to another svn server, which is called

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.