Control.Searchlist
Before proceeding you may want to read our getting started page.
What does this control do?
This control provides a simple way to show search results using a search form. The form's action is an external script that will output search results in JSON format. The control will query for new results everytime the form is changed by the user, the results will be shown in an external div.How to use
In order to use this control, paste this line of javascript right
at the beginning of your script tag:
You'll need a div that will act as a container for the results
of the Searchlist.
// MAIN FORM
'search_form',
// OPTIONS
{
// CALLBACK
// Action to perform when the user clicks on a result
'onClick': function(data) {
alert('data.index = '+data.index+', data.content = '+data.content+'');
},
// Search results
'attachTo': 'search_results'
}
);
Response example
'AF':'Afghanistan',
'AL':'Albania',
'DZ':'Algeria',
'AS':'American Samoa',
'AD':'Andorra',
'AO':'Angola'
}
array(
'AF' => 'Afghanistan',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola'
)
);