title: Invoking Controller Action From JavaScript .NET MVC
body: <p>A user can log into my app through Facebook. After the user presses the button to do initiate that, and authenticates through Facebook successfully, I then want the page that initiated the login, and which received the successful login information from Facebook, to essentially re-direct, to another view.  Where the user can then complete the registration process for my application. I have taken the time to read through other solutions, and I understand I may well have to use .AJAX.  Which is fine. The problem is it doesn't seem to be working.  </p>
  
  <pre><code>&lt;script&gt;
    // Called with the results from FB.getLoginStatus().
    function statusChangeCallback(response) {
    console.log('statusChangeCallback');
    console.log(response);
  
  // The response object returns with a status field that lets the
  // app know the current login status of the person.
  
      if (response.status === 'connected') {
    // User is logged into your app and Facebook.
      console.log("You are connected.");
      completeLogin();
      console.log("completeLogin called")
    testAPI();
  } else {
    // The person is not logged into your app or we are unable to tell.
    document.getElementById('status').innerHTML = 'Please log ' +
      'into this app.';
  }
    }
  
    // This function is called when someone finishes with the Login
    // Button.  See the onlogin handler attached to it in the sample
    // code below.
    function checkLoginState() {
      FB.getLoginStatus(function(response) {
        statusChangeCallback(response);
      });
    }
  
    function completeLogin() {
        $.ajax({
                type: "GET",
                url: '@Url.Action("List", "PotentialClient")'
        }).done(function () {
            console.log('Called ExternalLoginConfirmation');
        });
     }
  
    window.fbAsyncInit = function() {
    FB.init({
        appId: '1614609378567893',
        cookie     : true,  // enable cookies to allow the server to access
                      // the session
        xfbml      : true,  // parse social plugins on this page
        version    : 'v2.8' // use graph api version 2.8
      });
  
    // Now that we've initialized the JavaScript SDK, we call
     // FB.getLoginStatus() gets the state of the
    // person visiting this page and can return one of three states to
    // the callback provided:
    //
    // 1. Logged into your app ('connected')
    // 2. Logged into Facebook, but not your app ('not_authorized')
    // 3. Not logged into Facebook and can't tell if they are logged into
     //    your app or not.
    //
    // handles these three cases in the callback function.
  
    FB.getLoginStatus(function(response) {
      statusChangeCallback(response);
    });
  
    };
  
    // Load the SDK asynchronously
    (function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_US/sdk.js";
      fjs.parentNode.insertBefore(js, fjs);
     }(document, 'script', 'facebook-jssdk'));
  
    // Running a simple test of the Graph API after login is
    // successful.  
    function testAPI() {
      console.log('Welcome!  Fetching your information.... ');
      FB.api('/me', function(response) {
        console.log('Successful login for: ' + response.name);
        document.getElementById('status').innerHTML =
          'Thanks for logging in, ' + response.name + '!';
      });
    }
      &lt;/script&gt; 
  </code></pre>
  
  <p>Where "List", in my Ajax function, is my specific controller action, and "PotentialClient" the controller class. </p>
  
  <p>After I run this code, after I press the "Login via Facebook" button, in the developer console, I don't see any error about the url path.  </p>
  
  <p>But the page does not redirect to the view I need. </p>
  
  <p>What am I most certainly overlooking or not doing yet?</p>
  
  <p>Thank you, 
  CM</p>