title: Request Login and on success receive a callback
body: <p>I have two sites: <strong>one</strong> has a form, the <strong>other one</strong> has the database. They are on different domains.
  <strong>Site One</strong> with the form needs the data by <strong>Site Two</strong>, which he only get's after a successful login.</p>
  
  <p>I know how to open the login window and I know how to retrieve the data from Site Two.
  But I don't get it to work, so Site One requests the login and after success Site Two sends the data.</p>
  
  <p>Site Two works with  Spring and Java Server Pages, while Site One is fairly simple with pure HTML.</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt; SomeHtml Form &lt;/title&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
      function getParameters(){
          // get Login - **here he should wait until successful login**
          window.open('http://localhost:8080/test/login/start.mvc');
  
          // // USER IS LOGGING IN
          // after success, receive data
          $.getJSON('http://localhost:8080/test/secure/profile/services/export/getuser.mvc?callback=?',function(res){
              alert('Your name is '+res.lname);
              $('#lastname').val(res.lname);
              $('#firstname').val(res.fname);
          });
      }
      &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body &gt;
  
      &lt;h1&gt;Some Form&lt;/h1&gt;
  
      &lt;form action="save.html" id="FormName"&gt;
          &lt;div&gt;Lastname: &lt;input type="text" id="lastname"/&gt; &lt;/div&gt;
          &lt;div&gt;Firstname: &lt;input type="text" id="firstname"/&gt; &lt;/div&gt;
      &lt;/form&gt;
  
      &lt;button onclick="getParameters();"&gt;Fill Form&lt;/button&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Hope somebody can help, I am really stuck on this one!</p>