i am a complete newbie with angularjs, i am using $http to send to the server and the php file is very basic. i can get the http retrieving data from an echo. But from i am trying to get the data using return. Any ideas?
$scope.SendData = function () {
// use $.param jQuery function to serialize data from JSON
var data = $.param({
action: "get_clients"
});
var config = {
headers : {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
}
}
$http.post('http://********.co.uk/*******/switchboard.php', data, config)
.success(function (data, status, headers, config) {
$scope.PostDataResponse = data;
console.log($scope.PostDataResponse);
})
.error(function (data, status, header, config) {
$scope.ResponseDetails = "Data: " + data +
"<hr />status: " + status +
"<hr />headers: " + header +
"<hr />config: " + config;
console.log($scope.ResponseDetails);
});
};
the php file is very simple and is just an echo or a return.
<?php
echo "i am from the php file";
?>
<?php
return "i am from the php file";
?>