Programmatically select a service to update and enable the calendar

SupportProgrammatically select a service to update and enable the calendar
marco Staff asked 4 years ago
Hi, I see that upon manually selecting a service (single location, single worker scenario), there are two ajax calls, the calendar is refreshed and becomes enabled. In my use case, the user doesn't select the service through the drop down, but another UI (separate buttons) on the same page.  Is there a way to simulate choosing an option in the dropdown when the other UI button is clicked?  Sorry, I'm a javascript newbie. The alternative would be to replicate the ajax calls the dropdown selection would've made, nonce and all? Thanks.
2 Answers
Best Answer
marco Staff answered 4 years ago
Answering my own question if it can help anyone else: jQuery('select[name ="service"]').val(X).change() where X is the option index in the dropdown.
Nikola Loncar Staff answered 4 years ago
Hi Marco, thanks for update. Yes that will select service. Best regards, Nikola