Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The <code>response</code> object as defined by the documentation ("Overview" page):</p> <blockquote> <p>A response callback, which expects a single argument to contain the data to suggest to the user. This data should be filtered based on the provided term, and can be in any of the formats described above for simple local data (String-Array or Object-Array with label/value/both properties). It's important when providing a custom source callback to handle errors during the request. You must always call the response callback even if you encounter an error. This ensures that the widget always has the correct state.</p> </blockquote> <p>so, the 'response' argument is actually a callback, which must be called upon success of the ajax retrieval of autocomplete items. </p> <p>Since your data will come back via AJAX, your code must update the widget manually. jQueryUI provides an argument as a function so that your code can do that update by calling the function.</p> <p>You can see the <code>response</code> object defined in the declaration of the function used for the <code>source</code> option:</p> <pre><code>source: function( request, response ) </code></pre> <p>You could even take the AJAX call out of the equation and do something like this:</p> <pre><code>source: function(request, response) { response([{label:'foo', value: 'foo'},{label:'bar', value:'bar'}]); } </code></pre> <p>Would immediately call the <code>response</code> callback with an array of label/value pairs for the widget.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload