Reputation: 41
I am making a POST request in AngularJS as follows:
'use strict';
angular.module('app').controller('RegisterController', function($scope, $http) {
$scope.login = []
$scope.registrar = function() {
$http({
method : 'POST',
url : '/register/',
headers : {'Content-Type': 'application/json'},
data : {'username' : $scope.login.username,
'password' : $scope.login.password,
'email' : $scope.login.email,
'permission' : $scope.login.permission }
})
.success(function(data) {
$scope.gists = data;
})
.error(function(data, status) {
console.error('Repos error', status, data);
})
.finally(function() {
console.log("finally finished repos");
});
};
})
And in Django I'm calling request.POST["username"] method to get the information.
But information is not returning, I took a print command in request.POST and request.GET to see and both return QueryDict: {}.
I need to do some different configuration for the REST works?
Upvotes: 1
Views: 267