0

I have project in angular js.In that i want to make ajax request to specific url. I have used 2 methods.

$http.post(url, {
    params: {
        email: $scope.login.username,password:$scope.login.password
    }
})
.success(function(data, status, headers, config) {
  console.log('Success' + data);
})
.error(function(data, status, headers, config) {
  console.log('Error Status : ' + status);
});

and

$http({
    url: url,
    method: 'POST',
    data: loginData 
})
.success(function(data, status) {
    $scope.errormassage = '';
    accessToken = data.token;    
})
.error(function(data, status) {
    //alert("::status:"+status);
});

both are POST Request but when i see request in console it show request type OPTIONS.

this post request works well in POSTMAN Chrome plugin.

any help please.

Erazihel
  • 7,295
  • 6
  • 30
  • 53
  • 2
    See: http://stackoverflow.com/questions/11378075/http-method-changes-from-post-to-options-when-changing-content-type – Erazihel Aug 19 '15 at 08:42

1 Answers1

1

It probably sends a pre-request OPTIONS which purpose is to determine whether POST is allowed for an endpoint.

chervand
  • 83
  • 8