javascript - Angular $http.json promise returning error, though I can see the response -


i new working http promise objects.

i using angular js return json api http://www.asterank.com/api.

i have angular controller making call so:

  $http.jsonp('http://www.asterank.com/api/asterank?query={%22e%22:{%22$lt%22:0.1},%22i%22:{%22$lt%22:4},%22a%22:{%22$lt%22:1.5}}&limit=1&callback=json_callback'). success( function(data) {   console.log('great success'); }).error( function(r,t,et){   console.log(r);   console.log(t);   console.log(et); }); 

when check out chrome's network monitor see response:

http/1.1 200 ok date: sun, 06 oct 2013 19:06:26 gmt content-type: application/json transfer-encoding: chunked connection: keep-alive vary: accept-encoding server: gunicorn/18.0 set-cookie: session=eyjkaxnjb3zlcl9maxjzdf90aw1lijpmywxzzx0.btngmg.ef89vheeiplh8szijowcajejpha; httponly; path=/ content-encoding: gzip 

but seeing error method fire, never success :(

is because server not support jsonp? how access data of these apis if don't support jsonp support json?

found nice solution:

just in case comes across , me using express, create create simple little api on server using this:

https://npmjs.org/package/request

here don't need spin whole proxy server, can request json data server.

only problem here site doesn't declare jsonp support.

how access data of these apis if don't support jsonp support json?

write proxy layer on backend.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -