title: from jquery $.ajax to angular $http
body: <p>I have this piece of jQuery code that works fine cross origin:</p>
  
  <pre><code>jQuery.ajax({
      url: "http://example.appspot.com/rest/app",
      type: "POST",
      data: JSON.stringify({"foo":"bar"}),
      dataType: "json",
      contentType: "application/json; charset=utf-8",
      success: function (response) {
          console.log("success");
      },
      error: function (response) {
          console.log("failed");
      }
  });
  </code></pre>
  
  <p>Now I'm tring to convert this to Angular.js code without any success:</p>
  
  <pre><code>$http({
      url: "http://example.appspot.com/rest/app",
      dataType: "json",
      method: "POST",
      data: JSON.stringify({"foo":"bar"}),
      headers: {
          "Content-Type": "application/json; charset=utf-8"
      }
  }).success(function(response){
      $scope.response = response;
  }).error(function(error){
      $scope.error = error;
  });
  </code></pre>
  
  <p>Any help appreciated.</p>