Reputation: 14145
I'm trying to make following http request using angularjs $http
service
$http.get('http://myserver:8080/login?', {
params: {username: "John", password: "Doe" },
headers: {'Authorization': 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='}
}).then(function(response) {
alert('success');
alert(response);
}, function(x) {
alert('err');
});
};
my server is up and runing and I'm getting following firebug console error
So what I'm doing wrong here in sending http request?
Upvotes: 0
Views: 57
Reputation: 5988
Here is an example for send GET request using $http.get with params
$http.get('api/anyApi/get', { params: {name:name}})
As you see, you do not need absolute path and ? param to use.
Also, as jfadich mentioned - do not use GET for such requests.
Upvotes: 1