tags:

views:

32

answers:

1

hello, i have this form:

<form action="" method="get" style="margin-left: 2em">
  <input id="companies" type="text" name="company" value="" size="40" />
  <button type="submit" class="button-search">Search</button>
</form>

my json comes from this

http://localhost:8080/;companies?name=aba

and returns a valid json like:

{"name": "aba", "title": "Aba"}, {"name": "abak", "title": "Abak"}]

<script language="javascript">
$(function() {
  $("#companies").autocomplete({
    source: ";companies",
    minLength: 2,
    select: function(event, ui) {
      // perhaps do something with these?
      name = ui.item.name;
      title = ui.item.title;
   }
});
});
</script>

i get no results in the list being displayed!

what am i missing here?

thanks

A: 

According to the jqueryui autocomplete doc/demo, the url parameter is "term", not "name".

So, http://localhost:8080/;companies?term=aba should return the expected json, instead of http://localhost:8080/;companies?name=aba which you're using now.

Emmett
thanks, i got it now.
khinester
one more thing, i forgot to ask. if i want to pass the selected item so that a new select list is available how can this be done? something like the 'country', 'region', 'county' select where a user selects a country then a list is returned of the regions and then the county list is built?
khinester