Currently, I am attempting to pass parameters using the 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");
}
);
}
In this function, I have provided values for all variables, including the paramNames, with the aim of making it reusable. However, when debugging in the browser, I notice that the paramValues are correctly appended but the paramNames are hardcoded. The URL appears as follows:
http://localhost:7001/MyWeb/rest/getProj?cd=1419222398177¶mName1=666560¶mName2=1
I have verified that the URL mapping in my Spring controller is correct. Despite this, I encounter the following error:
406 (Not Acceptable)
I am wondering if it is not feasible to use keys as variables in a URL. Thank you in advance for any guidance provided.