title: How do I call a function after a redirect or refresh?
body: <pre><code>$('#submit').click(function(){
          window.location.replace("searchscreen.html");
              var term = $('#search').text();
              displaySearchEntries(term); 
  
  
          });
  </code></pre>
  
  <p>I am writing code to direct to a search results page and to call the javascript function to return the appropriate results.  As of now, this redirects the page, and displaySearchEntries(term) gets called, but disappears immediately.  It seems as if the redirect happens after the call to the function, but I don't know why that would be happening or how to prevent it.  Any suggestions?</p>