In a form, I am trying to send data as json to a php file, which is calculated correctly from a function in controller. But, if I try to send this calculated data as json, header shows as blank object. Can someone tell me why?
FORM:
<form id="form1" post="">
<p ng-model="result">{{add()}}</p>
<button type="submit" class="btn btn-default" ng-click="submitting()" >Submit</button>
</form>
CONTROLLER:
$scope.submitting = function(){
var request = $http({ method: "post", url: "php/store.php",
data: {"Answer": $scope.result} });
request.success(function (data) {
//alert("Successfully data entered! ");
});
}
$scope.add = function(){
var a = 10; var b = 20; var c = a + b;
return c;
}