Document ready after window.location change in jQuery
<p>I'm using <code>window.location.replace()</code> to redirect to a new page (same domain as the original). However, I need to run some jquery code after the redirection has finished. I can't simply embed the code I want to run on the target page, since it needs data I have on the current context.</p>

<p>Is there a way of setting a trigger similar to document.ready but on the new page?</p>

<p>My first idea was</p>

<pre><code>window.location.replace(data.redirect);
$(document).ready(
  function() {
   (use data variable from outer context)
  }
);
</code></pre>

<p>But this won't work as the function will be run on the current document.</p>

<p>Is this even possible?</p>
