Skip to content

Commit e65158e

Browse files
fix: button issue
1 parent 7f0ff49 commit e65158e

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

js/feedzy-setting.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,49 @@ jQuery(function ($) {
9898
}
9999
});
100100

101+
// License key.
102+
jQuery('.fz-license-section #license_key').on('input', function () {
103+
const licenseKey = jQuery(this).val();
104+
if (licenseKey !== '') {
105+
jQuery('#check_ti_license').removeAttr('disabled');
106+
} else {
107+
jQuery('#check_ti_license').attr('disabled', true);
108+
}
109+
jQuery('.fz-license-section input[name="license_key"]').val(licenseKey);
110+
});
111+
112+
jQuery('.fz-license-section #check_ti_license').on('click', function (e) {
113+
e.preventDefault();
114+
const _this = jQuery(this);
115+
_this.attr('disabled', true).addClass('fz-checking');
116+
117+
_this.parents('.fz-license-section').find('.feedzy-api-error').remove();
118+
119+
const LicenseData = _this
120+
.parent('.fz-input-group-btn')
121+
.find('input')
122+
.serialize();
123+
124+
jQuery.post(
125+
ajaxurl,
126+
LicenseData,
127+
function (response) {
128+
if (!response.success) {
129+
jQuery(
130+
'<p class="feedzy-api-error">' +
131+
response.message +
132+
'</p>'
133+
).insertAfter(
134+
jQuery('.fz-license-section').find('.help-text')
135+
);
136+
_this.removeAttr('disabled').removeClass('fz-checking');
137+
} else {
138+
window.location.reload();
139+
}
140+
},
141+
'json'
142+
);
143+
});
101144
snackbarNotice();
102145

103146
const initializeAutoCatActions = () => {

0 commit comments

Comments
 (0)