POST Autocomplete

Autocomplete control returning JSON data.

by bmarsh123

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/base/jquery-ui.css">
<input id="autocomplete1" />
<label id="lbl1"></label>

CSS

select {
    width: 200px;
}

JavaScript

$('#autocomplete1').autocomplete({
    source: function(request, response) {
        $.post('/echo/json/', {
            json: '["C#", "PHP", "Javascript", "Python"]'
        }, function(data) {
            response(data);
        }, 'JSON');
    },
    minLength: 1,
    select: function(event, ui) {
        $('#lbl1').html(ui.item.value);
    }
});