Answers for "ajax call do something while"

0

ajax call do something while

$('#loading').show() //show spinner
$.ajax({
    url: '/path/to/file',
    type: 'GET',
    data: {param1: 'value1'},
})
.done(function() {
    console.log("success");
})
.fail(function() {
    console.log("error");
})
.always(function() {
    console.log("complete");
    $('#loading').hide();//hide your spinner here!!
});
Posted by: Guest on July-21-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language