📜  ajax 调用 do something while - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:12.998000             🧑  作者: Mango

代码示例1
$('#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!!
});