Hi Yonatan,
I know you already solved the problem, but your first problem was: You
don't always need to use the "data" attribute to specify params. According
to what your server was expecting your params should be:
var params = {
'userID': $scope.tasks.id,
'Age': $scope.aversion.choice,
'Experience': $scope.aversion.choice,
'Gender': $scope.aversion.choice,
'Nationality': $scope.aversion.choice,
'Assets': $scope.aversion.choice,
task: 'questions'
};
Em quinta-feira, 15 de maio de 2014 07h47min39s UTC-3, Yonatan Kra escreveu:
>
> Hi,
> I have the following directive which sends a "get" request to the server.
> Here is the code:
> var params = {
>
> data: {
> 'userID': $scope.tasks.id,
> 'Age': $scope.aversion.choice,
> 'Experience': $scope.aversion.choice,
> 'Gender': $scope.aversion.choice,
> 'Nationality': $scope.aversion.choice,
> 'Assets': $scope.aversion.choice
> },
> task: 'questions'
>
> };
> var httpConfig = {'params': params};
> $http.get("ajax/dbHandler.php",httpConfig).success(function(data){
> console.log(data);
> });
> This doesn't work. When I use the following address:
>
> ajax/dbHandler.php?userID=5&Age=33&Experience=10&Gender=male&Nationality=somewhere&Assets=100
> I get the correct response, but not with angular http.
> What's the right way to use params?
> thanks
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.