execute a function after redirecting - javascript
<p>Okay, i have a simple button on my page (MyPage) which fades out the current div (fade 1) and fade in another one (fade 2). I have now realised that there might be chances that i would want to go to that page (fade 2) from somewhere else directly. I am able to redirect my page by <code>window.location</code>. However i also want that if that link was pressed (from some other random page), go to page (fade 1) and then <code>fadeOut</code>the current div and <code>fadeIn</code> another one (fade 2).</p>

<p>Hope this isn't too confusing. This is the code i am using to get to the page (MyPage):</p>

<pre><code>$('#fav').click(function(){
    window.location = 'production/produc_order.php';
    $('#view_production').fadeOut('slow');
    $('#create_order').fadeIn('slow');
})
</code></pre>
