0

I am trying to obtain a .json file from remote server (parse, firebase, amazon).

function fetchData(remoteJsonId){
    var url = "https://myAppName.parseapp.com/"+remoteJsonID+"?callback=JSON_CALLBACK";
    console.log(url); //This variable expands to the full domain name which is valid and                       returns success both on wget and the browser
    $http.jsonp(url).then(
        function(resp){

        },
        function(err){
            console.log(err.status) // This posts "404" on console.
        }
    );
} 

But If I open url in the browser the json file loads. Even if I wget url the json file loads. But through angular it returns a 404 not found. Why is angulars $http is returning 404 even though the file exists. Any solutions for this?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
InfinitePrime
  • 1,718
  • 15
  • 18
  • Don't open the same question twice please. Instead update/expand your original question to include a reproduction case. My answer to that question clearly shows how you **can** retrieve JSON data from Firebase through Angular's `$http.jsonp`, so you'll have to provide enough information for us to figure out why yours doesn't work. A jsfiddle/jsbin that reproduces your problem goes a long way towards that. – Frank van Puffelen Aug 30 '14 at 13:24
  • What do you see in the Network tab in DevTools ? How does the request made by Angular look like ? – gkalpak Aug 30 '14 at 16:56
  • After making JSONP work from the Angular side (in the question linked earlier), it came to light that OP is using Firebase hosting (not Firebase's hierarchical database). JSONP is not supposed on Firebase's Hosting servers. See http://stackoverflow.com/questions/25583064/how-does-http-jsonp-work – Frank van Puffelen Aug 30 '14 at 22:11

0 Answers0