I am using select2 version 4.0, and I am trying to make a programmatic selection to a select box which gets its data from an ajax call.
In the documentation, I found how
The only way to achieve this, is to first add an to the select dom with the data you would like to select, and right afterwards, select it like you would do with a regular select box. This was the official answer from kevin-brown also, on their github project page.
https://github.com/select2/select2/issues/3273
So, basicaly, if you know what would you like to select, you can easily create an element from it, add it to the original select box, and then select it by it's value:
var option=jQuery("