jQuery 在发送前加载

标签 jquery html ajax

我正在通过 jquery load 加载 html 内容。是否有类似于 jquery $.ajax beforesend 的方法用于 jQuery 加载。在加载内容时显示 gif 微调器

jQuery('.content').load(this.toString());

最佳答案

不是很复杂,加载前显示spinner,加载完成后隐藏在回调中

$('#gifSpinner').show();
$('.content').load(this.toString(), function() {
    $('#gifSpinner').hide();
});

关于jQuery 在发送前加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20618146/

相关文章:

javascript - this.appendChild 不是一个函数

javascript - jQuery Slider 在 IE 中不工作

javascript - 在所有其他 AJAX 调用之前发送 AJAX 调用

javascript - 添加到第 3 方页面的 DOM 时如何避免 HTML ID 冲突?

html - CSS - 具有固定 Div 的背景图像

javascript - 获取所有 xhr 请求

php - jQuery、Ajax、PHP 函数

jquery - Bootstrap 3 更新会在 Bootstrap 对话框打开或关闭时摇动 UI。我怎样才能摆脱这种行为?

html - Chrome 扩展 : Download/export content created "on the fly"

ajax - MVC3 ASP.NET Ajax BeginForm 在被其他 Ajax 注入(inject)时有时不起作用