2

The code I'm using is the following, in coffeescipt :

request_with_token =
  get:
    method: "JSONP",
    params:
      token: app["token"]
  save:
    method: "POST",
    params:
      token: app["token"]

$rootScope.API = "http://0.0.0.0:5200/1.0"

$scope.ajaxAccountUpdate = $resource($rootScope.API + "/account/update.json",
  { callback: "JSON_CALLBACK" }, request_with_token )

user = $scope.user
$scope.ajaxAccountUpdate.save user, (resource) ->
  $scope.show_message(resource)

But in my Log I have an OPTIONS instead a POST

[07/Feb/2013 16:50:48] "OPTIONS /1.0/account/update?callback=JSON_CALLBACK&token=mytoken HTTP/1.1" 200 -

Thanks

||||||
2

Probably because you're making a request to a different website from where the HTML is served, resulting in a 'Cross-Origin Resource Sharing' CORS pre-flight check. This is a security feature:

For more information: http://www.html5rocks.com/en/tutorials/cors/

||||||
  • +1. Make sure the URL you're viewing the site in your browser at matches the URL in $rootScope.API. – Michelle Tilley Feb 7 '13 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.