title: jQuery / Ajax: How to call function on targeted page after redirect
body: <p>I am new to Ajax and programming in general and hope someone can help me with this. </p>
  
  <p>I am using the following on a login page. 
  This is used to register new users and will automatically forward them to an index page if their registration was successfully. </p>
  
  <p>So far everything works as intended. 
  <strong>How can I call a jQuery function on the targeted index page from this or after that ?</strong>
  What I am trying to do is to show the user an alert telling them they were automatically logged in after the successful registration - so <strong>this alert should only show up on the index page if someone gets redirected there from the login page</strong>. </p>
  
  <p>I could extend the below link to pass a variable (e.g. "<code>&amp;origin=login</code>") and then use PHP to deal with that on the index page but that seems to be a large workaround and I was wondering if this could be achieved easier using Ajax. </p>
  
  <p>I did some research and found some references to Ajax but no clear guideline for that.<br>
  Can someone help me with this ?</p>
  
  <p><strong>My Ajax (in jQuery):</strong> </p>
  
  <pre><code>case 'registration successful':     
      $.ajax({        
          type: "post",   
          url: "ajax.php",
          cache: "false",
          data: {
              node: 'loginUser',
              email: email,
              pass: pass
          },
          success: function(data){
              // redirect to index page
              window.location.href = baseURL + '/index.php?lang=' + selectedLang;
              // after the redirect I would like to show an alert on the targeted index page
          }
      });
      break;
  </code></pre>
  
  <p>Many thanks in advance, 
  Mike</p>