title: Run HTTP post on successful post login
body: <p>I have a simple login, once user is logged in I have added a call back to run another post so that I have access to the post json to use in my system.</p>
  
  <p>I think the way I have done it is correct however I am getting error </p>
  
  <blockquote>
    <p>GetData is not defined</p>
  </blockquote>
  
  <p>Is this the correct way to do this </p>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>   $scope.LogIn = function () {
              $http({
                  url: "http://www.somesite.co.uk/ccuploader/users/login",
                  method: "POST",
                  data: $.param({'username': $scope.UserName, 'password': $scope.PassWord}),
                  headers: {'Content-Type': 'application/x-www-form-urlencoded'}
              }).then(function (response) {
                  // success
                  console.log('success');
                  console.log("then : " + JSON.stringify(response));
                  GetData();
                  // location.href = '/cms/index.html';
              }, function (response) { // optional
                  // failed
                  console.log('failed');
                  console.log(JSON.stringify(response));
              });
          };
  
  
          $scope.UserData = function ($scope) {
              $scope.UserName = "";
              $scope.PassWord = "";
          };
  
          $scope.GetData = function () {
              $http({
                  url: " http://www.somesite.co.uk/ccuploader/campaigns/getCampaign",
                  method: "POST",
                  headers: {'Content-Type': 'application/x-www-form-urlencoded'}
              }).then(function (response) {
                  // success
                  console.log('you have received the data ');
                  console.log("then : " + JSON.stringify(response));
                  location.href = '/cms/index.html';
              }, function (response) { // optional
                  // failed
                  console.log('failed');
                  console.log(JSON.stringify(response));
              });
          };
  </code></pre>