1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
    abhilashlr is on a distinguished road

      0  

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

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,525
    Vote Rating
    871
    Answers
    3564
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Do you set the extraParams after the global variables are created?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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
    abhilashlr is on a distinguished road

      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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,525
    Vote Rating
    871
    Answers
    3564
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Using GeoLocation is asynchronous
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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
    abhilashlr is on a distinguished road

      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.

Thread Participants: 1

Tags for this Thread