Timing judgment of asynchronously obtaining back-end data

the value of a variable is assigned through a function that gets back-end data asynchronously. How to deal with the logic related to this variable as soon as it has a value? How to judge the timing?
one way is to use a timer to determine the interval time. Is there any other way?

Mar.25,2021

Asynchronous acquisition must have a callback function. Can't you just handle it in the callback function


deal with it in callback


you can use Promise

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38540-2b651.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38540-2b651.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?