Php & Angularjs Ajax : What is the proper way to retrieve data from ajax request to php? -
just wan't ask how can retrieve data ajax request php api when coded :
controller :
$scope.addcustomer= function() { indexservice.addcustomer($scope.persons) .then(function(response) { console.debug('response :', response); }).catch(function(error) { console.debug('error :', error); }); }
service :
function addcustomer(data) { return $http({ method:'post', url: 'php/api/customer.php', data: data, datatype: 'json', contenttype: 'applications/json' }); }
i tried php file telling me undefined index 'data'
$data = $_post['data']
question : proper way retrieve data ajax call going php file? thank you
Comments
Post a Comment