Search code examples
jqueryasp.net-mvcjquery-load

asp.net mvc jquery load function and loading image?


I have following code to load partialView :

$(document).ready(function () {
    $("#customer_operations_container").load('/Customer/_AddCustomer');
}

Could I show a loading image?


Solution

  • Do something like

    $(document).ready(function () {
    
        // show loading animation        
        $("#loading-animation").show();
    
        $("#customer_operations_container").load('/Customer/_AddCustomer', function() {
             // this function is the callback of the 'load' method
             // hide loading animation
             $("#loading-animation").hide();
        });
    }