what I'm trying to achieve is that request.term changes depending on which input field I'm using
$("#field1", "#field2").autocomplete({
source: function (request, response) {
$.ajax({
url: 'autocomplete.php',
data: {field1 : request.term },
dataType: "json",
success: response,
error: function () {
response([]);
}
});
},
autoFocus: true
});
});
Code currently uses 'field1', I tried using $(this).attr('id')
but I may have done it in the wrong way, so I'd need a little help, thank you!