1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    0
    mail.goyalshubham is on a distinguished road

      0  

    Default 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

    Code:
      withCredentials: true,
                useDefaultXhrHeader: false,
    but still no luck.

    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,
            });
        }
    })

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,398
    Answers
    3549
    Vote Rating
    849
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What errors are you getting? Do they allow CORS?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    0
    mail.goyalshubham is on a distinguished road

      0  

    Default


    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.

  4. #4
    Sencha User
    Join Date
    Feb 2014
    Posts
    3
    Vote Rating
    0
    Xmaverick is on a distinguished road

      0  

    Default Same error

    Same error


    Any suggestion about this ? Google not support JSONP is correct ?