I have three pages on my site.
Page 1: A simple page where the user enters database search criteria
Page 2: HTML Edge Animated Page HTML5
Page 3: Search Results Page
Page 1 loads really fast. Pages 2 and 3 load slowly (about 3 seconds each).
I want to download page 2while the user enters search criteria in Page 1. As soon as the user clicks, enter Page 1, I want to page 2be displayed immediately. While page 2displayed (animation), I want to download page 3. After page 3loading BUT, but not before 5 seconds, I want to download page 3.
Great answers from everyone: OK. Here, what may work best: Comments are welcome !!!!
<script>
$(document).on('pageinit', '#first', function(){
$('#search').click(function(){
$.ajax({
url: "mypage2.html",
success: function(html){
$('#second').html(html);
$('#first').hide();
$('#second').show();
setTimeout(showThird,5000);
}
})
});
$.ajax({
url: "mypage3.html",
success: function(html){
$('#third').html(html);
$('#third').hide();
}
})
function showThird(){
$('#second').hide();
$('#third').show();
}
});
</script>
</head>
<body>
<div id="first">
<input type="button" id="search">
</div>
<div id="second">
</div>
<div id="third">
</div>
</body>
</html>
I could use some help to figure out how to do this. I already use jQuery and jQuery Mobile.
source
share