1. #1
    Sencha User
    Join Date
    Jan 2012
    Location
    Jacksonville, FL
    Posts
    38
    Answers
    2
    Vote Rating
    2
    rwbaker is on a distinguished road

      0  

    Default Answered: Best way to populate Proxy URL with lat/long?

    Answered: Best way to populate Proxy URL with lat/long?


    I'm trying to send my current lat/long to an API which returns a JSON object. What is the right way to structure this in the application?

    I was thinking I could create two global variables on App init, then when my particular View loads I could get the lat/long and set the variables then use those in my Store proxy URL, like:

    PHP Code:
    ...
    proxy : {
      
    type    'jsonp',
      
    url     'http://path/to/api?lat='latVariable '&long=' longVariable
    ... 
    Seems like there might be a cleaner way of doing this... thoughts?

  2. When you get the location via Geolocation, use setExtraParam twice on the proxy for both the latitude and longitude. Now when you load the store or refresh it the latitude and longitude params will always be used.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,408
    Answers
    3549
    Vote Rating
    851
    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


    When you get the location via Geolocation, use setExtraParam twice on the proxy for both the latitude and longitude. Now when you load the store or refresh it the latitude and longitude params will always be used.
    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.

  4. #3
    Sencha User
    Join Date
    Jan 2012
    Location
    Jacksonville, FL
    Posts
    38
    Answers
    2
    Vote Rating
    2
    rwbaker is on a distinguished road

      0  

    Default


    Great, thanks. Exactly what I needed—just didn't know what to call it.

    Here is a link to the docs if anyone else needs it: http://docs.sencha.com/touch/2-0/#!/...-setExtraParam

Thread Participants: 1

Tags for this Thread