The first parameter of the autocomplete plugin can be an array or a URL. All you have to do is provide the identifier of your category as a query string parameter for your autocomplete function.
var selectedCategory = $('.categories').val();
var query = '';
if (selectedCategory !== 0)
{
query = '?category=' + selectedCategory;
}
$("#suggest4").autocomplete('search_service.svc' + query, {
});
Hope this helps.
source
share