我有問題與角發送後JSON數據,從PHP角JS問題,我需要訪問$ _ POST [ '行動']
這工作
$http({
method: 'POST',
url: ajaxurl,
data: "action=get_employer_jobs",
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function (data) {
console.log(data);
$scope.jobs = data;
});
這確實不工作
app.controller('MainController', ['$scope', '$http', function ($scope, $http) {
console.log('MainController Running');
$http({
method: 'POST',
url: ajaxurl,
data: JSON.stringify({action:"get_employer_jobs"}),
headers: {'Content-Type': 'application/json'}
}).success(function (data) {
console.log(data);
$scope.jobs = data;
});
}]);