[ACCEPTED]-What does this javascript response function do?-response

Accepted answer
Score: 18

This object called response is a call back 22 function passed to the function labeled 21 source by the autocomplete method.

see Jquery UI Autocompleate

The 20 third variation, the callback, provides 19 the most flexibility, and can be used to 18 connect any data source to Autocomplete. The 17 callback gets two arguments:

A request object, with 16 a single property called "term", which 15 refers to the value currently in the text 14 input. For example, when the user entered 13 "new yo" in a city field, the 12 Autocomplete term will equal "new yo".

A 11 response callback, which expects a single argument 10 to contain the data to suggest to the user. This 9 data should be filtered based on the provided 8 term, and can be in any of the formats described 7 above for simple local data (String-Array 6 or Object-Array with label/value/both properties). It's 5 important when providing a custom source 4 callback to handle errors during the request. You 3 must always call the response callback even 2 if you encounter an error. This ensures 1 that the widget always has the correct state.

More Related questions