So I have one page called generate_schedule.php
and within this page I have a form where they user selects from two drop downs and clicks submit (see image below):
This form POST's the start date and end date to another php called generate.php
.
At the moment loading generate.php
takes about 1-2 minutes long as it is pulling a lot of information from multiple API's. While the page is loading I want to display a loading gif. Currently I have the following code for loading the next page:
<div class="se-pre-con"></div>
<style type="text/css">
.no-js #loader { display: none; }
.js #loader { display: block; position: absolute; left: 100px; top: 0; }
.se-pre-con {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
background: url(images/loading.gif) center no-repeat #fff;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.2/modernizr.js"></script>
<script type="text/javascript">
$(window).load(function() {
$(".se-pre-con").fadeOut();
});
</script>
However what this doe is that it only appears once generate.php
has fully loaded for a few seconds. I have also tried
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript">
$(window).load(function() {
$('.se-pre-con').hide();
});
</script>
But this does not work either it also only appears for a slit second once the generate.php
page has fully loaded
Basically what I want to happen is when I click generate schedule in generate_schedule.php
, a loading gif appears while generate.php
is loading