hubson
hubson

Reputation: 1

jQuery UI autocomplete and $.getJSON problem

I would like to use getjson method after UI autocomplete.

("#kod").autocomplete("kod.php", {
        width: 135,
        matchContains: true,                                               
        selectFirst: true      
            });

$("#kod").live("change",function() {
                $.getJSON('ajax2.php', {option: $(this).val()}, function(data) {    
                      $("#miasto").val(data.inputValue);  


            });

          });

If I type something traditional way or I choose value from list with keyboard it works ok. But if I choose something from autocomplete with mouse it doesn't work. Where is the problem? Thanks for help

Upvotes: 0

Views: 1025

Answers (1)

Jishnu A P
Jishnu A P

Reputation: 14382

Why don't you use the autocompletechange event.

$("#kod").live("autocompletechange",function() {
            $.getJSON('ajax2.php', {option: $(this).val()}, function(data) {    
                  $("#miasto").val(data.inputValue);

 });

Upvotes: 1

Related Questions