views:

73

answers:

1

Hi

i try to use jquery ui autocomplete. I have different autocomplete field in one page and i need to get data with different sources (different url) depend to wich autocomplete field is used. i know how can i get the typed data (request.term), but i cant find the way to get the selected field ID.

$(".ac").autocomplete({

     source: function(request, response) {       
       id = '??? the actually used field #id ???';
        $.ajax({
         type: "POST",
         url: "/admin_/sql/autocomplete/"+id, 
         data: "test=...",
         async: false,
         success: function(data) {  

           } 
       });
     },
     search: function() {
      // 
    },
     focus: function() {
      // 
      return false;
     },
     select: function(event, ui) {
      //
      return false;
     }
    });
A: 

almost took my half day ...

$(this).attr('element').attr('id')

voidnull
@voidnull : `this.id` didn't work?
Hogan