想让冻结按钮点击后变灰怎么才能实现呢?
html代码
{% for user in users %}
<tr>
<td>{{ user.user_name }}</td>
<td>{{ user.get_role_display }}</td>
{% if user.is_delete %}
<td>冻结</td>
{% else %}
<td>正常</td>
{% endif %}
<td>{{ user.date_created }}</td>
<td>
<a href="{% url 'user:user_update' pk=user.id %}" class="btn btn-xs btn-info">修改</a>
<button class="btn btn-xs btn-danger frozen" data-uid="{{ user.id }}" data-sid="{{ user.is_delete }}">冻结</button>
</td>
</tr>
{% endfor %}
js代码
$('.frozen').click(function () {
var user = $(this).data('uid');
var url = '/user_state/'+ user;
swal({
title: '确定要冻结吗?',
type: "warning",
showCancelButton: true,
cancelButtonText: '取消',
confirmButtonColor: "#ed5565",
confirmButtonText: '确认',
closeOnConfirm: true,
}, function () {
$.ajax({
type: 'post',
url: url,
success: function (data) {
location.reload();
}})
})});