Hi,
Thanks for the answer.
Ok - now I need something a bit different - I want to send the whole JSON
as a parameter so:
ajax/dbHandler.php?task=questions&data={userID:5,
Age:33,Experience:10,Gender:male,Nationality:somewhere,Assets=100
I already did it in a different page like this:
ajax/dbHandler.php?task=login&coupon=123432&data={"time":"12/5/2014
00:00:00"}
but for some reason, it doesn't work here...On Thu, May 15, 2014 at 2:06 PM, Mickey Vashchinsky <[email protected]>wrote: > Hi, > > Documentation says that "params" and "data" should be defined on the > config option, so you need: > > 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 > }; > var data = { > task: 'questions' > }; > var httpConfig = { > 'params': params, > 'data': data > }; > > $http.get("ajax/dbHandler.php",httpConfig).success(function(data){ > console.log(data); > }); > > I didn't check it, but I think it should be ok. > > > > On Thursday, May 15, 2014 1:47:39 PM UTC+3, Yonatan Kra wrote: >> >> 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 a topic in the > Google Groups "AngularJS" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/angular/4EB4hSw64iY/unsubscribe. > To unsubscribe from this group and all its topics, 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. > -- 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.
