Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using Bootstrap Typeahead based on a CartoDB column
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Typeahead + CartoDB</title>
<link href="" rel="stylesheet" type="text/css" />
<div class="well">
<input type="text" class="span3" id="filter" data-provide="typeahead" data-items="4" />
<script src=""></script>
<script src=""></script>
var sql = new cartodb.SQL({ user: 'viz2', format: 'json'});
sql.execute("SELECT distinct name FROM d3_world_borders ORDER BY name").done(function(data){
var subjects = [];
for (var i = 0; i < data.rows.length; i++){
$('#filter').typeahead({source: subjects})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment