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.
For an usage example check out the Meteora.Searchlist demo.
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.
Also, you'll need to setup a form that will act as your search
interface:
// 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'
}
To generate this response using
PHP you'll have to write something like this:
array(
'AF' => 'Afghanistan',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola'
)
);