The functionality of common HTML select elements is improved by the Select2 jQuery plugin. You can quickly look up and choose multiple items from a dropdown list using Select2.
It allows loading data using jQuery AJAX.
This tutorial focuses on integrating the Select2 plugin with CodeIgniter 4 and using jQuery AJAX to load data from a MySQL database. To ensure secure communication, the tutorial also covers how to pass the CSRF token with the AJAX request.
If you’re unfamiliar with enabling CSRF protection, then you can view this tutorial which provides a helpful resource to guide you through the process.