1

Here's my code for the search bar I added to Carto map, with some added script for my attempt at an autocomplete. So far, it hasn't worked. I wish I could be more precise about the problem, but I really don't know what it is. I'm not a developer and just hacking away from what I've found from other people online.

    function main() {

        var map = L.map('map', {
            zoomControl: true,
            center: [LAT, LONG],
            zoom: 15
        });
        L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', {
            attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
        }).addTo(map);

        cartodb.createLayer(map, 'MY_MAP.json').addTo(map)
            .done(function() {
                $('#searchButton').click(function() {
                    input = $("#ad").val();
                    input = titleCase(input)
                    console.log(input);
                                 function initAutocomplete() {
                                      function log( message ) {
                                        $( "<div>" ).text( message ).prependTo( "#log" );
                                        $( "#log" ).scrollTop( 0 );
                                      }
                                  }
                    var sql = new cartodb.SQL({
                        user: 'bmm80'
                    });
                    sql.getBounds("SELECT * FROM MY_DATA where DATA_COLUMN ILIKE '" + input +
                        "'").done(function(bounds) {
                        $(".title").fadeTo('slow', 0);
                        map.fitBounds(bounds)
                    });

                });
            });
    }