Edit in JSFiddle

var fakeServerResponse = ['Anthony', 'Angel', 'Anna', 'Aurelio'];
var datalist = document.getElementById('names');

document.getElementById('name').addEventListener('keyup', function () {
    if (this.value.length === 0) {
        return;
    }

    // Send Ajax request and loop of its result

    datalist.textContent = '';
    for (var i = 0; i < fakeServerResponse.length; i++) {
        if (fakeServerResponse[i].indexOf(this.value) !== 0) {
            continue;
        }
        var option = document.createElement('option');
        option.value = fakeServerResponse[i];
        datalist.appendChild(option);
    }
});
<input id="name" name="name" list="names" placeholder="Type 'Anna'" />
<datalist id="names">
</datalist>