简体   繁体   English

jQuery Spin插件什么都不做

[英]jQuery Spin plugin does nothing

I am using the jQuery Spin Plugin to show a spinner during an ajax call. 我正在使用jQuery Spin插件在ajax调用期间显示微调器。 I have everything set up like in the example, but nothing happens when I try to initialize the spinner. 我已经像示例中一样设置了所有东西,但是当我尝试初始化微调器时没有任何反应。

<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js" type="text/javascript"></script>
<script src="javascripts/jquery.spin.js" type="text/javascript"></script>
<link href="stylesheets/jquery.spin.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="spinner" data-spin></div>
    <select id="mySelect">...</select>
    <select id="code">...</select>
    <div id="person"></div>
</body>

$(function() {
$(document)
    .ajaxStart(function() {
        $("#spinner").spin("show");

    })
    .ajaxStop(function() {
        $("#spinner").spin("hide");
    });

$("#mySelect").change(function() {
    $.ajax({
        url: "ajax-refresh",
        data: {
            code: $("#code option:selected").val(),
        },
        success: function(resp) {
            $("#person").html(resp);
        }
    });
});
});

The instructions shown in the referenced link includes these commands. 参考链接中显示的说明包括这些命令。 在此处输入图片说明

It appears that the .spin function may need to be called first without arguments before making subsequent calls with 'show' and 'hide'. 看起来.spin函数可能需要先不带参数地调用,然后再使用“ show”和“ hide”进行调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM