Json Retrive Problem

Heelo,
I have problem about my retrive json post.
there is my services:


there is All response my rest.
getProspekDetail:
image

When I use getAll Controller i don’t have anything problem.
but when I use getProspekDetail, I have problem, i can’t retrive any response.
There is my controller

Sorry bad english.

maybe your request is failing --> handle also the error callback. Or your api can not handle the request

1 Like

Thanks bengtler, i try add .error function, but no error found.
there is my project.
https://github.com/hanasitc/zana

Sorry if it does not help you but I have 2 remarks:

  • $resource would seem more appropriate than $http
  • why do you use a POST method for getting data?

If you are trying to retrieve data you should use GET method, not POST.

Also is better to use $http as a promise instead of the success method.

try using this code:

var req = {
        method: 'GET',
        url: URL
        headers: {
            
        }
    };
    return $http(req);

in your controller:

    prospekServices.getProspekDetail(data).then(
        function(result){ //success function
    },
    function(error){//error function
           console.error(error);
    }

);

Good Luck

@gmarziou and @rmont66

So, traditionally a POST is not a way to GET, right?

Well… Haha. I use Parse.com as a back end, they have this set up called Cloud Code where it hosts your custom api calls and can be accessed via a rest call like api.parse.com/v1/functions/myCloudCodeFunction.

It requires the method to come in as post, however. So it’s possible that he could be using an api structure like that. I don’t like it, but that’s how we gotta do it (as far as I know for at least Parse).

As for the answer, I don’t think it actually has to do with your code. Everything looks fine as far as I can see. Have you tried using a separate tool or link to get the data for the company and see if it’s returning it? It’s better to rule out your code being the issue by doing that. On Mac I use a tool called “Rested”. What platform are you using?