javascript - Issuing http get request and accessing the data I'm getting -


in app, i'm issuing request retrieve json server.

        $http.get('http://localhost:3000/documents/2.json')             .success(                     function(success){                         console.log("success");                     })             .error(                     function(error){                             console.log("error has occurred")         }); 

right now, 200 response, i'm not sure how access json file i'm getting url in web app. assume there's gotta function(jsondata) not sure how implement in function above.

i'm issuing in client side(written in angular) , getting data server(written in rails). front end (in angular) part of rails app now.

major edit:

this version (1.4.9) op using.

in angularjs $http documentation v1.4.9 sample script of trying do.

// simple request example: $http({   method: 'get',   url: '/someurl' }).then(function successcallback(response) {     // callback called asynchronously     // when response available   }, function errorcallback(response) {     // called asynchronously if error occurs     // or server returns response error status.   }); 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -