I am working with AngularJS with Classic ASP.
While I have create one simple form in classic asp and submit it through AngularJS HTTP POST mathod and on other side when I am trying to get POST variable value in another page I am getting a null value.
Actually, while calling the HTTP POST method I can see in browser network mode that data was sent to the given URL, but at the given URL page I am not able to retrieve the posted data.
Here is my code
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.4/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-sanitize.js"></script>
</head>
<body>
<div ng-app="CallSiteVisitor" ng-controller="SessionAndVisitor">
<form ng-submit="SaveData()" >
<input type="text" name="firstname" ng-model="form.firstname">
<input type="text" name="lastname" ng-model="form.lastname">
<input type="submit">
</form>
</div>
var app = angular.module('CallSiteVisitor', ['ngSanitize']);
app.controller('SessionAndVisitor', function($scope, $http) {
$scope.form = {};
$scope.SaveData = function() {
$http({
method : 'POST',
url : '/XXXX.asp',
data : $scope.form,
headers : { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }
})
.success(function(data) {
if (data.errors) {
$scope.errorName = data.errors.name;
$scope.errorUserName = data.errors.username;
$scope.errorEmail = data.errors.email;
} else {
$scope.message = data.message;
}
});
};
});
Here I have try multiple way to get POST variable like
Response.Write request("firstname")
Response.Write request.Form("firstname")
Response.Write request.Form("form.firstname")
In all these cases I will get null value instead of textbox value.