Grow your CSS skills. Land your dream job.

Scripts in queue

  • # February 17, 2013 at 1:37 am

    When the page is ready I have a function which runs first and get data from a google spreadsheet and using them to create content of the main container in the html. Then the rest of the script follows which depends on the content that is created from the previous function. For example there is an array which should get as values the elements that have been created before.

    The first function take few seconds because there a lot of data and as I did some debugging, it seems that while the content is still loading the script has been moved on and the array seems empty.

    Both parts of the script have been tested and work fine separate one from each other.

    I am using .getJSON() if that helps, in order to get the data.

    What can I do for that?

    I fixed it with a second callback

    # February 18, 2013 at 5:23 pm

    i will check for specified element to be ready first before use it for anything.

    $(‘.element1′).ready(function(){ //something });
    $(‘.element2′).ready(function(){ //something else });

    or if that element require dynamically changes..

    maybe can check for its content before do anything..

    $(‘.dynamic_element’).length

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".