title: Is it possible to pass two parameters to $http.post from AngularJS
body: <p>I do not have an issue constructing <code>$http.post</code> request with an object or single parameter, but in one particular case I need to pass 2 simple parameters, an integer and a string.</p>
  
  <p>Normally I use:</p>
  
  <pre><code> $http.post(url, id)
         .success(function (data, status, header) {
             $scope.result = data;
  
         })
         .error(function (data, status, header) {
             $scope.result = "Data: " + data +
                 "&lt;hr /&gt;status: " + status;
             console.log(header.responseText);
         });
  </code></pre>
  
  <p>But how can I modify it to pass two parameters?</p>
  
  <p>I have tried creating an object with two properties and passing that object:</p>
  
  <pre><code>var inData = {
     id: id,
     param2: param2
  }
  
  $http.post(url, inData)
     .success(function (data, status, header) {
         $scope.result = data;
  
     })
     .error(function (data, status, header) {
         $scope.result = "Data: " + data +
             "&lt;hr /&gt;status: " + status;
         console.log(header.responseText);
     });
  </code></pre>
  
  <p>But then I am not sure what to specify as a parameter in my Web API method that is passed in via <code>url</code> parameter.</p>
  
  <p>Is that possible to pass in 2 separate parameters instead of passing in an object?</p>