go to page after the page is loaded 
<p>okay so on my home page i'm doing a user name and password check and then im using jquery document.location to send you to a logged in page say secure.php.... while this works it sends you to secure.php first and then images start loading ... how can i do it in such a way that it loads the entire page and then send you to secure.php</p>

<p>example : -</p>

<pre><code> $.ajax ({
         url: loginCheck.php,
         type: 'POST',
         data: username + password ,
         success: function (check){
                if(check==1)
                    document.location= /loginpage/secure.php
                else alert(invalid username or pass)

            }
         });
</code></pre>
