samedi 7 octobre 2017

JS Conditions not working

I don't know why, but even if I change the variable, the condition not working. Looks like it goes over.

$(document).ready(function() {
    setInterval("secret_key_verification()",5000);
});

function secret_key_verification() { 
  var actual_status = 0 // NOT DEFINED = 0 | INVALID = 1 | VALID = 2 | BANNED = 3
  
  $.ajax({
   type: "GET",
   url: "validate.php",
   data: "secret_key=character",
   success: function(data){
     if (data.status == 'INVALID') {
                 if (actual_status !== 1) {
                        actual_status = 1;
                        echo 'Invalid';
                }
                 } 
        }
 });
}

Aucun commentaire:

Enregistrer un commentaire