So following on from my JSON question yesterday. I’m calling a JSON array to populate some autocomplete options.
My JSON array currently comes from a fetch call to a php script.
That PHP script, queries my database. Basically everything 600rows and growing, will end up 2,500+. (let’s call each row a person) and I’m creating a list of people object and returning it.
As I type a name. Say…. Fredrick.
By the I’ve got to the “d” I’ve called my database 4 times.
Is there a way of speeding this up as it’s fast but laggy.
What am I best to do?
Saving the JSON from the first call?
Have a cron job to create a static JSON file every hour?
Write a php specific code for the personID, perName what I’m using in my JSON file?