angularJS sending OPTIONS instead of POST

前端 未结 4 932
一个人的身影
一个人的身影 2021-01-18 08:57

Im stuck at this 2 days I can not find a solution. When im doing an AngularJS POST it Sends OPTIONS in the header and returns error from the API the code looks like this no

4条回答
  •  离开以前
    2021-01-18 09:41

    // Simple POST request example (passing data) :

    $http.post('/someUrl', {msg:'hello word!'}).
      success(function(data, status, headers, config) {
        // this callback will be called asynchronously
        // when the response is available
      }).
      error(function(data, status, headers, config) {
        // called asynchronously if an error occurs
        // or server returns response with an error status.
      });
    

提交回复
热议问题