user1287523 user1287523 - 3 months ago 11x
jQuery Question

Loading screen in classic ASP page

I have a legacy classic ASP page that is taking a long time to load. This is because before loading it must run a large number of database queries. Load time is upwards of 10 seconds.

The page structure looks like this:

<% SQL Queries %>
<html>...Display the data from the queries..</html>

ie, all the queries occur before the markup renders.

Due to the long load times I want to create a loading screen that will run before the queries start and close when the queries end, to provide an indication to the user. I'm wondering how to do this? The examples I've seen (such as BlockUI) rely on the page being called through ajax, but this particular page is being called using a standard 'a href'.



Classic ASP comes with the handy Response.Flush command. Such code will cause content to appear before the SQL queries start executing:

Response.Write("<div id=""PleaseWaitPanel"">")
Response.Write("Processing, please wait...")
Response.Write("<img src=""please_wait.gif"" />")
'SQL Queries...

Now to hide it after queries are done you need simple jQuery:

<script type="text/javascript">
$(document).ready(function() {