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

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -