Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angularjs $http get method not sending any params

I have created a jsfiddle, were i am tring to perform a http get using $http when clicked on the test button, The syntax and the structure of $http.get seems correct to me, but it is not sending the selected params (query string {data:$scope.newuser}) in the url.

here is the fiddle :

jsfiddle.net/8sZLs/2/

And at php side i tried , But not showing the values posted

like image 267
RONE Avatar asked Dec 13 '25 23:12

RONE


1 Answers

You cannot send an object with get, you need to make a post request as following.

 $http({
   url: 'request-url',
   method: "POST",
   data: { 'message' : message }
})

As @YauheniLeichanok suggested, another way is to use query parameters, params of $http.get, in this case the strings you pass will appear as: ?key1=value1&key2=value2

like image 108
anvarik Avatar answered Dec 15 '25 11:12

anvarik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!