我想添加一个加载gif的一些jQuery脚本。我以为我可能会使用this plugin之前已经工作过,但我想弄清楚为什么我提交表单时不会触发它。我有没有把它放在正确的地方?为什么我的jquery loader不工作?
<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>
您是否在控制台中遇到任何错误?该插件是否正确加载?你有一个称为“post_data”的有效表单吗? –