/    Sign up×
Community /Pin to ProfileBookmark

Faster way JSON/OOP/MySQL

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?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumDec 15.2020 — >to populate some autocomplete options.
>
This is a common task and there is no need to invent the wheel again: jQuery UI features this and there is an option to start the query only when the user has typed at least, say three characters:

https://jqueryui.com/autocomplete/#multiple-remote
Copy linkTweet thisAlerts:
@kiwisauthorDec 15.2020 — @Sempervivum#1625905

The wheel is re-invented. I don't like jQuery either.

Really looking for how to make it quicker.
×

Success!

Help @kiwis spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...