Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Select multiple Twitter users by searching their profile info.
- // Marco Polo takes the URL from the form's 'action' attribute. This can also
- // be set explicitly using the 'url' option, but since this form is solely for
- // the search field, it makes sense to use the 'action' attribute.
- $('#twitterUserSearch').manifest({
- // Use each person's Twitter username as the display text.
- formatDisplay: function (data, $item, $mpItem) {
- return data.screen_name;
- },
- // Use each person's Twitter user ID as the value to be submitted.
- formatValue: function (data, $value, $item, $mpItem) {
- return data.user_id;
- },
- // Options passed on to Marco Polo.
- marcoPolo: {
- // The API key is sent as extra data with the request. The search value is
- // automatically included as 'q', but can be changed through 'param' option.
- data: {
- apikey: 'api_test-W1cipwpcdu9Cbd9pmm8D4Cjc469',
- },
- // Since the Infochimps API embeds the array of result objects in the
- // 'results' attribute — and doesn't provide a way to limit the number of
- // results — we return the first 20 results programmatically.
- formatData: function (data) {
- return data.results.slice(0, 20);
- },
- // Use each person's Twitter username as the display text.
- formatItem: function (data, $item) {
- return data.screen_name;
- }
- },
- // Only allow autocomplete results to be added. No arbitrary values.
- required: true
- });
Add Comment
Please, Sign In to add comment