Reputation: 3
I've the following function in jquery:
$(document).ready(function(){
$('.folder-action').bind('click', function location() {
if(parent.document.location.pathname!="/home.php"){
window.location.replace("home.php");
location();
});
//Other portion of code that need page has been loaded.
});
});
When the replace has been excecuted I need that all the elements of the page are already loaded to execute other portions of the code in the new page(home.php). It've tryed with:
setTimeout(function() {location()}, 300);
But it still doesn't work. Is it possible to wait until all elements of the page are loaded?
Upvotes: 0
Views: 2062
Reputation: 1078
You can not do it like that because once you used the replace function, the browser will leave your current page and won't execute anymore code.
The best thing to do is to put your Other portion of code in the $(document).ready
of the home.php
Upvotes: 2