Probably a very basic question, but I cannot seem to find a simple answer.
I have a GET method leveraging Angular\'s $http that is requesting a promise
You can create a JS object with your parameters, and then use jQuery's $.param (http://api.jquery.com/jquery.param/) to easily serialize them into a URL query string:
var parameters = {
amount: 123,
description: 'test'
};
And on your $http call:
$http.get('URL_OF_INTEREST'+'?'+$.param(parameters))
.success(
function(success){
console.log(success)
})
.error(
function(error){
console.log(error)
});
EDIT: OR if you don't want to use jQuery:
$http.get('URL_OF_INTEREST', { params: parameters })
.success(
function(success){
console.log(success)
})
.error(
function(error){
console.log(error)
});
On server-side, just use the req object to get the parameters:
var amount = req.query.amount;
var description = req.query.description;