If you know how to send jQuery AJAX request in Core PHP then it is simpler for you to do it in CodeIgniter.
In CodeIgniter, you can use the controller and model to handle AJAX call instead of creating a separate file. Make AJAX call either from the view or external script file.
In this tutorial, I am creating a simple example to demonstrate the AJAX calling in CodeIgniter 3.