awesomecomplete icon indicating copy to clipboard operation
awesomecomplete copied to clipboard

how to use dataMethod

Open hoangnm89 opened this issue 9 years ago • 2 comments

i dont know how to use dataMethod. i setup like this: $(function() { $('#friend_id2').awesomecomplete({ //more config dataMethod: dataMethod }); }); var dataMethod = function(term, $awesomecomplete, onData) { onData = [ { name: 'Ryan Lapin', email: '[email protected]', phone: '(512) 829-4442' }, { name: 'Angela Kapoor', email: '[email protected]', phone: '(435) 149-4341' }, { name: 'Pam Martin', email: '[email protected]', phone: '(204) 189-7995' } ]; return onData; };

it didn't work for me. I want to call ajax and get data from server

hoangnm89 avatar Jul 22 '15 03:07 hoangnm89

Call onData instead. Replace return onData; with onData([{ name: /* … */ }]);.

issa-tseng avatar Jul 22 '15 06:07 issa-tseng

thanks for reply, but i still dont understand what you say: onData([{ name: /* … */ }]); write for me little bit of code to show how it work. thank you so much

hoangnm89 avatar Jul 22 '15 07:07 hoangnm89