.load() with success function

前端 未结 1 1084
心在旅途
心在旅途 2021-02-07 10:10

I know this has been asked many times before...

I have a simple (\'#Div\').load(file.php?id=\'+id+\'&page=\'+page)

The on click event acts as fo

相关标签:
1条回答
  • 2021-02-07 10:45

    The problem is that load is asynchronous. The function call returns before the AJAX request is complete. If you have code that needs to be executed after the request is complete, you need to use the complete callback specified in the API:

    $('#div').load('file.php?id='+id+'&page='+page, function(){
        $("#loading").empty();
        $("#button1").show();
    });    
    
    0 讨论(0)
提交回复
热议问题