简体   繁体   中英

php form hide process page before moving on

I have a page that is calling another file to get MySQL data on load. When I load the page, I call to a MySQL DB and get data allowing the user to enter a code that unlocks some features.

main-page.php process-page.php

main-page.php has:

include('process-page.php');

near the top, then loads the HTML.

process-page.php connects to the MySQL DB, connects to my MongoDB, then runs 3 SQL queries and writes the results into my MongoDB collection.

Everything works fine, except MongoDB (so it's very fast) and I'm passing information into it from a MySQL DB (so it's very slow).

The problem is that I'm echoing the data in the preloading page so I see the data, then my page loads. I know I can stop echoing the data, but MySQL is slow and I would get a white page until the data process is completed.

Is there a better method of loading my page and having the included page be hidden as it collects data?

Thanks

I finally just added a DIV with display:none style.

I was hoping for some AJAX type change I could make that would collect the data in the background.

Thanks for all your good answers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM