1

I am trying to use google place service

$http({
    method : 'GET',
    url : 'https://maps.googleapis.com/maps/api/place/textsearch/json?query=hotels in US&key=XXXXXXXXX&callback=JSON_CALLBACK'
})
.success(function(data) {
    console.log('data' + data);
})
.error(function(data) { });

API call is OK 200. But on console it gives error XMLHttpRequest cannot load https://maps.googleapis.com/maps/api/place/textsearch/json?query=hotels%20in%20US&key=XXXXU&callback=JSON_CALLBACK. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://192.168.1.85:8443' is therefore not allowed access.

I change method:JSONP then it returns data but with syntax error like : required. My server is tomcat 7. I am also using CORS filtercom.thetransactioncompany.cors.CORSFilter .

cbass
  • 2,548
  • 2
  • 27
  • 39
Prashant Thorat
  • 1,752
  • 11
  • 33
  • 54

1 Answers1

0

Try changing $http() to $http.jsonp(url).succes....

Meenesh Jain
  • 2,532
  • 2
  • 19
  • 29
Manuel van Rijn
  • 10,170
  • 1
  • 29
  • 52