基本上我想要显示一个加载GIF ...
这是我正在使用的代码:
$("#mail-change input[type=submit]").click(function(event){
$.post('user_settings.php', $("#mail-change").serialize(), function(res) {
$(res).insertBefore(".grey");
}, 'html')
});
Run Code Online (Sandbox Code Playgroud)
kar*_*m79 15
$("#loading").ajaxStart(function() {
$(this).show();
}).ajaxStop(function() {
$(this).hide();
});
Run Code Online (Sandbox Code Playgroud)
编辑:
$("#mail-change input[type=submit]").click(function(event){
$("#loading").show()
$.post('user_settings.php', $("#mail-change").serialize(), function(res) {
$(res).insertBefore(".grey");
$("#loading").hide();
}, 'html');
});
Run Code Online (Sandbox Code Playgroud)
要么:
$.ajax({
url : 'user_settings.php',
data: $("#mail-change").serialize(),
beforeSend: function(){
$("#loading").show();
},
complete: function(){
$("#loading").hide();
},
success: function(res) {
$(res).insertBefore(".grey");
}
});
Run Code Online (Sandbox Code Playgroud)
看到:
| 归档时间: |
|
| 查看次数: |
8964 次 |
| 最近记录: |