Link to home
Start Free TrialLog in
Avatar of Abhay Kalariya
Abhay KalariyaFlag for India

asked on

Getting problem with http post method in angularJS to classic asp

Hi
I am new in angularJS.
i am working with classic asp and angularJS.
when i call http post method to classic asp page in angularJS  its send data to classic asp page. but when i am try to retrieve posted data on classic asp page i found nothing?

is there i am doing wrong?

here is my code sample

----------Html code---------------
<div ng-app="CallSiteVisitor" ng-controller="SessionAndVisitor">
<form ng-submit="SaveData()" >
<input type="text" ng-model="form.firstname">
<input type="text" ng-model="form.lastname">
<input type="submit">
</form>
</div>
---------Html code end----------

-----------Controller code ------------
var app = angular.module('CallSiteVisitor', ['fm']);
      app.controller('SessionAndVisitor', function($scope, $http) {

$scope.form = {};
        $scope.SaveData = function() {
                  $http({
                    method  : 'POST',
                    url     : 'http://www.xyz.com/action_contactformAJ.asp',
                    data    : $scope.form,
                    headers : { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }
                   })
                    .success(function(data) {
                        if (data.errors) {
                                        // error code
                        } else {
                         // data code
                        }
                    });
                  };
      });
-----------Controller  code end---------


---------- Classic asp page code (action_contactformAJ.asp)-------------------------
<%
Response.write request("FirstName") & "  " & request("LastName")
' here i found null value but when i see in browser by pressing f12 key in network mode its shown that when post method call its send data with text box values but on other side i found nothing.... is there i am doing some wrong things?


%>
---------- Classic asp page code end------------------------


please advice

thanks
Abhay
Avatar of Manju
Manju
Flag of India image

In classic asp, for post method, we use request.form("FirstName").

Try response.write request.form("FirstName")

and also in html, change the below

<input type="text" ng-model="form.firstname">

to

<input type="text" name = "FirstName" ng-model="form.firstname">
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.