I'm trying to decipher how to get the json post from a JavaScript file to a PHP file.
This is my JS file:
var url2 = '/php/extractkeywords.php'; var jsonData = angular.toJson({ text: $scope.userTyping, data: post }); $http({ url: url2, method: "POST", data: "data=" + window.btoa($scope.textHTML), headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function (data, status, headers, config) { // Sending to extractkeywords.php })
And this is my PHP file:
$data = json_decode(urldecode(base64_decode($_POST["data"])));
When I try to print $data, I don't get anything.