I'm using codeigniter 4. I have been doing ajax request directly to a view file. Now I want to use external ajax_file_name.js and call it inside that view
My Views directory looks like this:
--| Views
-----| Products
---------| index.php
---------| ajaxFolder
--------------|ajax_operation.js
I always do ajax in index like this
Views/ Products/ index.php
$(function($){
//my ajax cruds functions goes here
})(jQuery);
But now I want to be able to use ajax external file like this:
Views/ Products/ index.php
<script src="/ajaxFolder/ajax_operation.js"></script>
Controllers/Product.php
public function index()
{
return view("Products/index");
}
How can I achieve that since controller load php file?
Thanks.