How does CGI programming achieve waiting for pages to load?

the server uses the CGI,B page button POST method to point to the generate.pl script.
script processing takes a long time and generates a new page B.
but after A clicks the button, the page content does not change, the window title shows the loading circle, and it takes a long time for B content to appear.
how can I display B content immediately after clicking the button to avoid repeated clicks?

Apr.03,2022
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-7b747b-29c02.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-7b747b-29c02.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?