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,556
    Answers
    3931
    Vote Rating
    1272
      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! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  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
  •