example/as-a-service/express/controller.js
function instantSearch() {

    const q = $("#searchbox").val();
    if (q === '')
        return;

    const matcher = "/matcher?beginsWith=" + q;
    const request = host + matcher;

    console.debug(request);

    $.getJSON(request, '', {})
        .done(data => {

            $("#searchbox").autocomplete({
                source: data,
                select: (event) => {
                    event.stopPropagation();
                    $("#search").trigger("click");
                }
            });
        })
        .fail((d, textStatus, error) => {

            const err = d.status + " " + error + " -> message: " + d.responseText;
            bootstrapAlert.error(err);
            console.error(`Search request failed: \n ${err}`);
        });
}
function instantSearch() {

    const q = $("#searchbox").val();
    if (q === '')
        return;

    const matcher = "/matcher?beginsWith=" + q;
    const request = host + matcher;

    console.debug(request);

    $.getJSON(request, '', {})
        .done(data => {

            $("#searchbox").autocomplete({
                source: data,
                select: (event) => {
                    event.stopPropagation();
                    $("#search").trigger("click");
                }
            });
        })
        .fail((d, textStatus, error) => {

            const err = d.status + " " + error + " -> message: " + d.responseText;
            bootstrapAlert.error(err);
            console.error(`Search request failed: \n ${err}`);
        });
}
function instantSearch ( ) { const q = $ ( "#searchbox" ) . val ( ) ; if ( q === '' ) return ; const matcher = "/matcher?beginsWith=" + q ; const request = host + matcher ; console . debug ( request ) ; $ . getJSON ( request , '' , { } ) . done ( data => { $ ( "#searchbox" ) . autocomplete ( { source : data , select : ( event ) => { event . stopPropagation ( ) ; $ ( "#search" ) . trigger ( "click" ) ; } } ) ; } ) . fail ( ( d , textStatus , error ) => { const err = d . status + " " + error + " -> message: " + d . responseText ; bootstrapAlert . error ( err ) ; console . error ( ` \n ${ err } ` ) ; } ) ; }
looking for suggestions
looking for suggestions