title: How do I call a method in Scala through javascript & ajax?
body: <p>I do not know if my title was perhaps a little misleading. But here's what I really need help with.</p>
  
  <p>I'm making a get on this url:</p>
  
  <pre><code>$.get("/fb/login/"+fbEmail, function(data){
     console.log(data);
  });
  </code></pre>
  
  <p>This is my routes:</p>
  
  <pre><code>GET /fb/login/:email  presentation.controllers.Auth.authenticateSocialNetwork(email:String)
  </code></pre>
  
  <p>And here's my action:</p>
  
  <pre><code>def authenticateSocialNetwork(email:String) = Action {
     if(!editorRepo.getEditorByEmail(email).isEmpty){
        Redirect(routes.Profile.editorProfile).withSession(Security.username -&gt; email)
     } else {
        Redirect(routes.Profile.initiatorProfile).withSession(Security.username -&gt; email)
     }
  }
  </code></pre>
  
  <p>My expectation from this is that my action gets <strong>called</strong> and fires of what's inside it. In other words, <strong>Redirecting</strong>. </p>
  
  <p>But what actually happens, which is not so illogical, is that my $.get call gets a response with my redirect's.</p>
  
  <p>How do I actually <strong>call</strong> my action-method, without sending a response to javascript?</p>
  
  <hr>
  
  <p>Here's my function in javascript, posting this snippet for it to be more clear in our discussion in the comments above. </p>
  
  <pre><code>function addClickToLoginButtons(){
  $("#loginWithFb").click(function(){
      FB.login(function(response){
          if(response.authResponse){
              FB.api('/me', function(response){
                  var fbEmail = response.email;
                  $.get("/fb/isRegisteredAtNetwork/"+fbEmail+"/facebook", function(data){
                      if(data == "true"){
                          if(confirm("Do you want to log with facebook-account "+fbEmail+"?")){
                                  $.get("/fb/login/"+fbEmail, function(data){  *//HERE'S WHERE I WOULD WANT TO CALL MY METHOD IN SCALA*
                                      console.log(data);
                                  });
                          } else {
                              console.log("try again with a different facebook-account");
                          } //end confirm else
                      } else {
                          console.log("Logged in not in database");
                      }//end get else
                  });
              });
          } else {
              console.log("permission not granted");
          } // end authResponse else
      }, {scope: 'email'});
  });
  }
  </code></pre>