Results 1 to 3 of 3

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

  1. #1
    Sencha User
    Join Date
    Jan 2012
    Location
    Jacksonville, FL
    Posts
    38
    Answers
    2
    Vote Rating
    2
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,335
    Answers
    3885
    Vote Rating
    1296
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      0  

    Default

    Great, thanks. Exactly what I neededjust 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

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
  •