CodeIgniter Forums
How to not repeat a database call everytime an ajax request is made in PHP codeignite - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: How to not repeat a database call everytime an ajax request is made in PHP codeignite (/showthread.php?tid=84739)



How to not repeat a database call everytime an ajax request is made in PHP codeignite - CarmosKarran - 11-05-2022

i am new to codeigniter and ajax requests are consuming db calls each time they are made, a simple autocomplete box will query db everytime a letter is entered and i want to be able to save results in php and not javascript after first query for later use until user leaves the page.

as an example i did a simple autocomplete input box using ajax and php(codeigniter) and it works fine, but what is the best way to do it in codeigniter? session variables or constants.php or is there a better way thank you!