2
After more reading I finally solved my problem, mostly based on this question
Here is the working version of my code:
$http({
url: '/api/v1/user/company',
method: "POST",
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
data: $.param({
user_id: user_id,
company_id: parseInt(company_id),
action: action
})
}).success(function (response) {
return response.data
});
The problem was: I didn’t specify headers
and also didn’t include $.param
in the data
I was passing through.
Source:stackexchange.com