title: Redirect page and call javascript function
body: <p>I need to redirect to another page onClick of submit and call a function making an ajax call. This is what I have :</p>
  
  <pre><code>$('#submitButton').click(function() {
  
  window.location.href = "otherPage";
  displayData();
  });
  </code></pre>
  
  <p>Also, Another way I tried is to set the form fields on otherPage by using </p>
  
  <pre><code>var elem = window.document.getElementById(field);
  elem.value = "new-value";
  </code></pre>
  
  <p>so that I could call the eventhandler of a submit button present on otherPage, but it doesn't work. Please let me know where I am wrong.</p>