Control.Autocomplete
Widget demo
Type the first two or three letters of your country of origin, in English.
Meteora.uses('Control.Autocomplete');
Meteora.onStart(
function () {
new Autocomplete(
'autocomplete_demo_input',
{
'action': '/demo/ajax_search',
'onClick': function(data) {
$('result').setContent(Widget.fromHTML('<b>Country name:</b> '+data.content+', <b>Code:</b> '+data.index));
$('result-wrapper').show();
}
}
);
}
);
</p>
HTML source
<input name="q" type="text" id="autocomplete_demo_input"/>
<span id="result-wrapper" style="display: none">
<h4>Result</h4>
<span id="result"></span>
</span>
<span id="result-wrapper" style="display: none">
<h4>Result</h4>
<span id="result"></span>
</span>
Javascript source
Meteora.uses('Control.Autocomplete');
Meteora.onStart(
function () {
new Autocomplete(
'autocomplete_demo_input',
{
'action': '/demo/ajax_search',
'onClick': function(data) {
$('result').setContent(Widget.fromHTML('<b>Country name:</b> '+data.content+', <b>Code:</b> '+data.index));
$('result-wrapper').show();
}
}
);
}
);
JSON response
{
"AF":"Afghanistan",
"AL":"Albania",
"DZ":"Algeria",
"AS":"American Samoa",
"AD":"Andorra",
"AO":"Angola",
"AI":"Anguilla",
"AQ":"Antarctica",
"AG":"Antigua and Barbuda",
"AR":"Argentina"
}
"AF":"Afghanistan",
"AL":"Albania",
"DZ":"Algeria",
"AS":"American Samoa",
"AD":"Andorra",
"AO":"Angola",
"AI":"Anguilla",
"AQ":"Antarctica",
"AG":"Antigua and Barbuda",
"AR":"Argentina"
}