gpt4 book ai didi

jquery - 为什么我的 jquery 加载器不工作?

转载 作者:行者123 更新时间:2023-12-01 07:45:31 25 4
gpt4 key购买 nike

我正在尝试将加载 gif 添加到某些 jquery 脚本中。我想我可能会使用this plugin这以前有效,但我试图弄清楚为什么当我提交表单时它没有触发。我把它放在正确的位置了吗?

<script>
$(document).ready(function() {
$('#post_data').submit(function() {
//I've placed the plugin here
$('#spinner').pleaseWait();
$.ajax({
url: 'process.php',
type: 'POST',
dataType: 'html',
data: $(this).serialize(),
success: function(newContent) {
$('#mytable').prepend('<tr>' + newContent + '</tr>');
$("form").trigger("reset");

}
});

return false;
});
});

我希望它出现的 div。

<div class="center-block" id="spinner"></div>

最佳答案

原因:

给微调器 div 一些宽度和高度。尝试按照插件中给出的方式自定义微调器。在加载器插件之后在主体末尾加载脚本和 jQuery。尝试仅使用 Spinner 插件而不使用 ajax。在 ajax 中添加 beforesend 属性,并在该方法中加载微调器并在 ajax Complete 属性处停止 😉

关于jquery - 为什么我的 jquery 加载器不工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38903528/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com