-
15 Mar 2012 7:40 AM #1
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:
Seems like there might be a cleaner way of doing this... thoughts?PHP Code:...
proxy : {
type : 'jsonp',
url : 'http://path/to/api?lat='+ latVariable + '&long=' + longVariable
...
-
Best Answer Posted by mitchellsimoens
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.
-
15 Mar 2012 7:50 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
15 Mar 2012 10:22 AM #3
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


Reply With Quote