I was trying to use $http.get. The page only works if the url I give is a local 'vehicles.json' But when I give a url, it spits out a blank page. Could someone please help me understand my error?
1 Answer
You have to replace this line:
$scope.vehicle = data.['get_vehicles'];
for this:
$scope.vehicle = data['get_vehicles'];
If you modify this in your Plunker, will work.
I hope this solves your question.
1 Comment
borferpa
Did you check if the proglem is CORS? to check it you can open the console (F12 in Chrome) and look at if appear some message saying something like "XMLHttpRequest cannot load domain.example. Origin domain.example is not allowed by Access-Control-Allow-Origin." If your problem is this, you can transform your chrome with disable security (stackoverflow.com/questions/3102819/…)
&format=jsonp? Anyway this is what you need to do:If (API supports JSONP?) { use JSONP } else if (CORS supported?) { use GET JSON(API url) } else { create server side proxy and GET JSON(proxy url) }.