Results 1 to 4 of 4

Thread: Not able to get data from Google place API

  1. #1

    Default 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 Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448
    Answers
    3997

    Default

    What errors are you getting? Do they allow CORS?
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3

    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

    Default Same error

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •