-
22 Feb 2012 1:30 AM #1
Unanswered: Passing a global variable defined to url method of proxy
Unanswered: Passing a global variable defined to url method of proxy
Hi,
I have an app that determines the browser latitude and longitude (geolocation - html5) and I stored inside 2 global variables before even starting the sencha application code.
Now I have a script on my server that fetches the lat/long from the proxy call (jsonp) where I pass url as my script url, extraParams as lat,lon. My query is if I pass something like below, it works fine, I'm able to retrieve the JSON data:
but If i want to use the global variables that I have already used to store the browser latlong it doesn't work.Code:extraParams{ lat: '12', lon: '13' }
What is the error in the following code?
Kindly help. I wanna be dynamic!Code:extraParams{ lat: url_lat, lon: url_long, }
-
22 Feb 2012 7:15 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,085
- Vote Rating
- 453
- Answers
- 3153
Do you set the extraParams after the global variables are created?
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.
-
22 Feb 2012 7:37 AM #3
Yeah, now i understood the problem, is there a way to load the global variable function first which is defined in native JS code before the sencha JS executes ??
-
22 Feb 2012 7:46 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,085
- Vote Rating
- 453
- Answers
- 3153
Using GeoLocation is asynchronous
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.
-
22 Feb 2012 7:56 AM #5
Actually what I've coded is that I have a native JS code which will trace the browser lat/long using html5. Based on that I will set the global variables, after setting them, I am using to retrieve a set of JSON data using the 'jsonp' method. But when I tried 'alert(variable)' in the native JS and the JSON data retrieval parts, I found that the native JS loads after setting up the url for the JSON data retrieval.
Is there any method like Ext.application() which will load the native JS code first and then the sencha application.


Reply With Quote