Results 1 to 5 of 5

Thread: Passing a global variable defined to url method of proxy

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
      0  

    Exclamation 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:

    Code:
    extraParams{
        lat: '12',
        lon: '13'
    }
    but If i want to use the global variables that I have already used to store the browser latlong it doesn't work.

    What is the error in the following code?

    Code:
    extraParams{
       lat: url_lat,
       lon: url_long,
    }
    Kindly help. I wanna be dynamic!

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,413
    Answers
    3898
    Vote Rating
    1269
      0  

    Default

    Do you set the extraParams after the global variables are created?
    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.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
      0  

    Default

    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 ??

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,413
    Answers
    3898
    Vote Rating
    1269
      0  

    Default

    Using GeoLocation is asynchronous
    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.

  5. #5
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
      0  

    Default

    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.

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
  •