0

so I'm loading a url which takes a fairly long time to load, about a minute. I'm wondering how I should go about executing some additional javascript or jquery code only once the page has fully finished loading.

I was trying this but it was not working

$(document).ready(function()
{
    $.ajaxSetup(
    {
        cache: false,
        success: function() {
            $('#div_loading').hide();
            $('#div_done').show();
        }
    });
    $.ajax("process.php?q=<?=$id?>&bitrate=<?=$bitrate?>");
});
1
  • Are you loading the process.php url with $.ajax above? It looks like you do not have any data returned, is that correct? Commented Jan 26, 2014 at 0:35

1 Answer 1

1

You could use a jQuery deferred object e.g.

$.ajax("process.php?q=<?=$id?>&bitrate=<?=$bitrate?>").then(function(data){

});

Basically when the $.ajax call returns, the then function will be executed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.