I am trying to send parameters in GET method in angularJs.
$scope.callMethod = function(url , paramName1, paramName2 ,paramValue1 , paramValue2)
{
$http.get('rest/'+url+'?cd='+ (new Date()).getTime(),{params:{paramName1:paramValue1 ,paramName2:paramValue2}}).success(function(data)
{
console.log("in success block");
}).error(function(data)
{
console.log("in error block");
}
);
}
Here I provide the value of all the variables including the paramNames because I want this method to be reusable but during debug in browser I see that paramValues are being appended in correct way but paramNames are hardcoded. URL is as follows:
http://localhost:7001/MyWeb/rest/getProj?cd=1419222398177¶mName1=666560¶mName2=1
I have provided correct URL mapping in my spring controller. If gives me the error
406 (Not Acceptable)
Kindly tell me that is it not possible to provide keys as variables in URL. thanks in advance