On the select event (using the select option) of A add code to change the source option of B so that the A value is passed as a query string parameter, then have your server-side code use that parameter.
- $("#teamsB").autocomplete({source: "getTeams" });
- $("#teamsA").autocomplete({
- source: "getTeams",
- select: function(event, ui){
- $("#teamsB").autocomplete("option","source", "getTeams?competitor=" + ui.item.value);
- }
- });
Then your server-side code for the getTeams would do something like this...
See if the competitor parameter was passed and see if it has a value
If so, filter the list of teams by this competitor and by the autocomplete term
Else just filter by the term
Hth,
Dave
P.S. jQuery code was just typed in this forum and not tested or checked for syntax errors.