You likely need to place $('#dropdown').val('99');
in the success
callback of .ajax
.
e.g.,
$.ajax({
url: 'google.com',
success: function(){
$('#dropdown').val('99');
}
});
$.ajax
is asynchronous, meaning any code directly after it will run before the ajax request is complete. It's likely you're trying to set the value to 99
before it's in the dropdown.