Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

Someone can help me to get data from this url: http://carbono.utpl.edu.ec:8080/wscodigosqr/webresources/entidades.qrusuarios/userlogin?usuario=dimoreno

I tried this:

.service('Serv', ['$http',function($http) {
        this.servicio = function() {
          return $http.get('http://carbono.utpl.edu.ec:8080/wscodigosqr/webresources/entidades.qrusuarios/userlogin?usuario=dimoreno'
        };

Serv.servicio().success(function(data){
          $scope.datos=data;
alert($scope.datos+" this is your rol");  
}])

But I can't get data Please help me someone...!!

share|improve this question

Your code is not structured correctly, it's missing a closing curly bracket. See the Angularjs $http docs for how to use $http.

Here is an example service, and a controller.

SERVICE

.service('Serv', ['$http',function($http) {
  return {
        getData: function(callback){
            $http.get('http://carbono.utpl.edu.ec:8080/wscodigosqr/webresources/entidades.qrusuarios/userlogin?usuario=dimoreno').success(function(response) {
                callback(response);
            });
        }
    }
}]);

CONTROLLER

.controller("MyController", ["$scope", "Serv", function ($scope, Serv) {

  Serv.getData(function(response){
    $scope.datos = response.data;
    alert($scope.datos+" this is your rol");  
  });
}
share|improve this answer
    
I tried to use your answer but it doesn't work....!! Thanks – Diego Israel Moreno 14 hours ago
    
Do you see an error in the console? – pedro 14 hours ago
    
I can't... because I don't have CORS but when I run in my phone. It doesn't show anything..... What can I do...? only I want to get estudiante from server. Please help me – Diego Israel Moreno 13 hours ago
    
Can you test it from within a trusted domain? – pedro 12 hours ago
    
Yes.... there is not problem .... this url is from my school ..... Is trusted If you want you can use the URL – Diego Israel Moreno 11 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.