How trigger autocomplete event from another event
Hi all,
I have autocomplete implemented like :
- var cbx_search_in_description= $("#cbx_search_in_description").is(':checked') ? 1 : '0'
- var cbx_search_in_past_events= $("#cbx_search_in_past_events").is(':checked') ? 1 : '0'
- $( "#autocomplete_events" ).autocomplete({
- source: function( request, response ) {
- $.ajax({
- url: ajax_object.backend_ajaxurl,
- dataType: "json",
- data: {
- action: 'autocomplete-events',
- artist_id: this_m_artist_id,
- search_in_description : cbx_search_in_description,
- search_in_past_events : cbx_search_in_past_events,
- q: request.term
- },
- success: function( data ) {
- response( $.map( data, function( item ) {
- return {
- value: item.lat+"="+item.lng,
- label: item.place_name
- }
- }));
- }
- });
- },
It works and question is, that I want to make autocomplete with some additive parameters ( cbx_search_in_description and cbx_search_in_past_events )
and I want to trigger autocomplete event when I click on these 2 checkboxes.
I tried on onchange event to run method
- $( "#autocomplete_events" ).change();
but it does not work. How to make correctly?