Set "select option" (selected) within AJAX call in "document ready"

Hello,
i need to get data from the database and have to set the selected index after getting it from the AJAX call but nothing works. Tried a lot: GetElementByID, JQuery, adding/ removing a new option.
I can set the values of the input fields but it doesn’t work with the select options.
Is there a workaround for this?

This works for the input fields:
document.getElementById(“email”).value = email

This works for the select option in document ready but not within the AJAX call in the success block:
$(’#action #ticket_number’).val(3);

I also tried an after page load unsucessfully:
$(window).on(‘load’, function() {

$(’#action #ticket_number’).val(5);
});

Maybe it has nothing to do with static websites in general, it’s the Materialize template.
I added the attribute “selected” by JS but it ignores it and only detects the hardcoded attribute.
Confusing?!

What database? Jekyll is a static site generator, there is no database.
For JavaScript help you might have better luck asking on Stackoverflow.