Add error logging, UI status indicators, and update README
This commit is contained in:
@ -23,4 +23,8 @@
|
||||
.nav-tab-active {
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #fff;
|
||||
}
|
||||
.wpa-superstar-toggle label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
@ -1,14 +1,21 @@
|
||||
jQuery(document).ready(function($) {
|
||||
$('.wpa-superstar-toggle input').on('change', function() {
|
||||
var option = $(this).attr('name');
|
||||
var value = $(this).is(':checked') ? 1 : 0;
|
||||
var $input = $(this);
|
||||
var option = $input.attr('name');
|
||||
var value = $input.is(':checked') ? 1 : 0;
|
||||
$.post(wpaSuperstar.ajaxurl, {
|
||||
action: 'wpa_superstar_update_option',
|
||||
option: option,
|
||||
value: value,
|
||||
nonce: wpaSuperstar.nonce
|
||||
}, function(response) {
|
||||
console.log(response);
|
||||
if (response.success) {
|
||||
$input.next('.wpa-status').remove();
|
||||
$input.after('<span class="wpa-status" style="color: green; margin-left: 10px;">Saved</span>');
|
||||
setTimeout(function() { $('.wpa-status').fadeOut(); }, 2000);
|
||||
} else {
|
||||
console.error('Error:', response);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user