-
10 Feb 2013 4:59 AM #1
Unanswered: Not able to get data from Google place API
Unanswered: Not able to get data from Google place API
Hi Guys!
I am trying to receive data from google place api. I can not use JSONP proxy because response is not in form of it. I have to use normal ajax, but its giving me cross browser ajax related errors. I tried using
but still no luck.Code:withCredentials: true, useDefaultXhrHeader: false,
Can any one help me on this??
My store looks like
Code:Ext.define('BW.store.addplace.SearchPlaceStore',{ extend:'Ext.data.Store', requires:['BW.model.addplace.SearchPlaceModel'], config:{ model:'BW.model.addplace.SearchPlaceModel' }, setQuery:function(query, apiKey){ this.setProxy({ type: "ajax", url : "https://maps.googleapis.com/maps/api/place/autocomplete/json?input="+ query +"&types=geocode&sensor=false&key=" + apiKey, reader: { type: "json", rootProperty: "predictions" }, withCredentials: true, useDefaultXhrHeader: false, }); } })
-
12 Feb 2013 7:56 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
What errors are you getting? Do they allow CORS?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
12 Feb 2013 10:13 PM #3
XMLHttpRequest cannot load https://maps.googleapis.com/maps/api/place-----. Origin http://localhost is not allowed by Access-Control-Allow-Origin.
I dont think they allow CORS. this service worked when I packaged my application in native wrapper. but when runnning on mobile browser, it throwing this error.
So for now, I have used google api javascript functions to load data.


Reply With Quote