Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You'll have to use a <code>callback</code> argument for <code>source</code>.</p> <p>Something like this should work (untested).</p> <pre><code>$('#abbrev').val(""); $("#state").autocomplete({ source: function(term, callback) { callback($.getJSON('states.php', {states: term, typeo: $("#typeo").val()})); }, minLength: 2, select: function(event, ui) { $('#state_id').val(ui.item.id); $('#abbrev').val(ui.item.abbrev); } }); }); </code></pre> <p>More info about this is on <a href="http://jqueryui.com/demos/autocomplete/" rel="nofollow">http://jqueryui.com/demos/autocomplete/</a></p> <blockquote> <p>The third variation, the callback, provides the most flexibility, and can be used to connect any data source to Autocomplete. The callback gets two arguments:</p> <p>A request object, with a single property called "term", which refers to the value currently in the text input. For example, when the user entered "new yo" in a city field, the Autocomplete term will equal "new yo".</p> <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>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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