Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
igCombo with googleapis
posted

Hi, I wounder if there is a way to get cities from googleapis.

$("#selectLocation").igCombo({
loadOnDemandSettings: {
enabled: true,
pageSize: 25
},
autoComplete: true,
requestType : "get",
filteringType: "remote",
responseDataKey: "predictions",
valueKey: "description",
textKey: "description",
itemTemplate: "${description}",
width: "100%",
height: "48px",
dataSource: 'https://maps.googleapis.com/maps/api/place/autocomplete/json?key=xxxxx&types=(cities)&language=sv&region=se&input=??????',
responseDataType: "json",
placeHolder: "City"

});

Google needs the "input" parameter to return search results

Example:

GetRequest: https://maps.googleapis.com/maps/api/place/autocomplete/json?key=XXXX&types=(cities)&language=sv&region=se&input=karl

Returns:

{
  "predictions": [
    {
      "description": "Karlskrona",
      "id": "df1ab6dd7852b9cef64ca81e91291e80b9d01840",

SO THE QUESTON:

How to add the input parameter in the  generated get request, or is there another way of getting cities into igCombo from google apis?

Br,

Peter

Parents
  • 18204
    Offline posted

    Hello Peter,

    Thank you for posting in our forums!

    After some research, it looks like Google requires you to make your requests from the server.  So what you should do is make a request to your server which will fetch the data from Google, and then send it back to the client browser.

    To do this, you would set the igCombo's dataSource to your server's method that queries Google.

    I have attached a simple MVC sample that demonstrates this.  If you have any further questions or concerns with this, please let me know.

    igCombo_GoogleAPIsData.zip
Reply Children
No Data