json - How to send cross-domain request to google places api (seems it does'nt support jsonp)? -
i trying make ajax call google places api reviews business no success. using
crossdomain : true,datatype: 'jsonp',
is giving error
uncaught syntaxerror: unexpected token :
i think doesn't support jsonp
..is there way it?
thanks
please try following code response google place api
$.ajax({ type: 'get', url: 'https://maps.googleapis.com/maps/api/place/autocomplete/json?&input=houston&sensor=true&types=(cities)&key=<your key>', async: false, jsonpcallback: 'jsoncallback', contenttype: "application/json", datatype: 'jsonp', success: function (json) { console.dir(json.sites); }, error: function (e) { console.log(e.message); } });
google responds in form of jsonp callback in place api.kindly replace key in url
Comments
Post a Comment