title: AngularJs $http.post() send data null state:-1
body: <p>Could anyone tell me why the following statement does not send the post data to the designated <em><strong><code>URL</code></strong></em>?</p>
  <pre><code>login: function (username, password) {
      var deferred = $q.defer();
  
      var url = Config.serverUrl() + &quot;/api-token-auth/&quot;;
      var data = {
          'username': username,
          'password': password
      };
  
      $http.post(url, data).then(function (responseData) {
          console.log(responseData);
          alert(url);
          alert(JSON.stringify(data));
          $localForage.setItem('shopper-user', responseData.data).then(function (user) {
  
              var token = &quot;JWT &quot; + user.token;
              $rootScope.token = token;
              $http.defaults.headers.common.Authorization = $rootScope.token;
  
              deferred.resolve(user);
          });
  
      }, function (error) {
          alert(url);
          alert(JSON.stringify(data));
          console.error(error);
          alert(JSON.stringify(error));
          deferred.reject(error);
      });
  
      return deferred.promise;
  }
  </code></pre>
  <p>The URL is called on the server, but only go to the <em>error state</em></p>
  <h3>Error:</h3>
  <pre><code>{&quot;data&quot;:null, &quot;status&quot;:-1,&quot;config&quot;:{&quot;method&quot;:&quot;POST&quot;}}
  </code></pre>