打卡签到-20CMS v1.2
- 站点记录
- 2天前
- 30热度
- 0评论
var FORMHASH = 'ee1ee8d8';
jQuery.noConflict();
(function($) {
$(document).ready(function() {
$('#signin-btn').on('click', function() {
var btn = $(this);
btn.prop('disabled', true).text('签到中...');
$.ajax({
url: 'plugin.php?id=erling_qd:action&action=sign',
type: 'POST',
dataType: 'json',
data: {
formhash: FORMHASH
},
success: function(response) {
try {
if(response && response.success) {
// 刷新页面
location.reload();
} else {
$('#signin-result').html('<p class="error">' + (response && response.message || '签到失败') + '</p>');
btn.prop('disabled', false).text('签到失败请稍后再试');
}
} catch(e) {
$('#signin-result').html('<p class="error">解析响应失败</p>');
btn.prop('disabled', false).text('签到失败请稍后再试');
}
},
error: function(xhr, status, error) {
var msg = '请求失败: ' + error;
if(xhr.responseText) {
try {
var response = JSON.parse(xhr.responseText);
msg = response.message || '请求处理失败';
} catch(e) {
msg = '服务器返回了错误页面:\n';
}
}
$('#signin-result').html('<p class="error">'+msg+'</p>');
btn.prop('disabled', false).text('签到失败请稍后再试');
}
});
});
});
})(jQuery);