Skip to content

Commit

Permalink
Issue #366 - Code improvement as per feedback from reviewer
Browse files Browse the repository at this point in the history
  • Loading branch information
BhargavBhandari90 committed Feb 26, 2024
1 parent be73315 commit c98bafc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions assets/js/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
let timer = 0;
let currentRequest = null;

fromRule.keyup(function(el) {
fromRule.on('input',function(el) {
publishBtn.prop('disabled', true); // Disable submit button.
fromRule.addClass('ui-autocomplete-loading'); // Add loader.
if (timer) {
Expand Down Expand Up @@ -99,16 +99,15 @@
_wpnonce: $('#srm_redirect_nonce').val()
},
beforeSend : function() {
if ( currentRequest != null ) {
if ( currentRequest !== null ) {
currentRequest.abort();
}
},
success: function( data ) {

// Remove loader.
if ( fromRule.hasClass( 'ui-autocomplete-loading' ) ) {
fromRule.removeClass( 'ui-autocomplete-loading' );
}
fromRule.removeClass( 'ui-autocomplete-loading' );

if ( '1' === data ) {
$('#message').html( '' ).hide();
publishBtn.prop('disabled', false);
Expand Down

0 comments on commit c98bafc

Please sign in to comment.