0

I'm using REST ASP.NET and I need to get some values from my frontend form to research my database in my backend which is written in c#. I've tried using this article Getting a POST variable, but it did not work at all.

  • 1
    Hello Arthur, welcome to the SO community ! Please read this article https://stackoverflow.com/help/how-to-ask. Here you could post what you tried – Zooly Aug 23 '18 at 08:02

1 Answers1

0

FYI, to submit some data to backend and get something result back - you should use your client angularjs service which is injects $http, httpType via constructor, e.g. below the simple function which is using GET method:

function someDataService($http, httpType) {
return {
         getUserSettings: getUserSettings
}

function getUserSettings(apiUrl, userId){
var httpSettings = {
        method: httpType.GET,
        url: apiUrl + '/getUserSettings?userId=' + userId,//e.g.  'http://localhost:5000/myAPI/getUserSettings?userId=1'
        headers: {}
      };
return $http(httpSettings)
    .then(function (res){return res;});
}
Damir Beylkhanov
  • 525
  • 3
  • 13