Feedback on my Generator (seems slow?)

Hi all
I decided to re-visit my quote generator to be more web responsive in viewport (mobile vs desktop) as well as include the quote’s author in the hashtag tweet.

However it seems to generate the quote very slow…

Essentially I made a loop that until a quote (including the author) string is less than 140 characters, keep searching.

Is there way faster doing this?

Any critics/input will be greatly appreciated!

It does feel a bit slower, which makes sense as it could be making quite a few calls to the server. Considering that not every user will want to Tweet a quote, maybe it would be better to display every quote regardless of length and then truncate it if they decide to send a Tweet?

1 Like

I agree with Portable…

You could also modify the ajax call to the api (quotesondesign.com/wp-json/posts) to return a larger number of posts (10-50?) and then loop over them locally to find shorter quotes.That way you would minimize the time spent waiting for a response from the API.