In my angular application, I am trying to sent the data to php script and then return a callback.
Here is the angular code:
var data = { value: 'somestring' };
$http.post("post_backend.php", data).success(function(data, status) {
alert(data + status);
}).error(function(data, status) {
alert(data + status);
});
In my php code I have a simple calling back function:
if (isset($_POST['value'])) {
header('Content-Type: application/json');
echo json_encode('successful callback');
exit();
}
But when it executes, I get a success status in the alert message and nothing else. I dont get the data ('successful callback') and can't figure out for about a couple of hours, what is the problem?