0

I have a validate function like this:

function submit_otp(){
  var otp=jQuery('#otp').val();
  jQuery.ajax({
    url:'../../../Code_Verification/check_otp.php',
    type:'post',
    data:'otp='+otp,
    success:function(result){
      if(result=='yesFalse'){
        jQuery('#otp_error').html('Please enter your valid code');
        $("#button-next-3").attr("disabled", true);
      }
      if(result=='yesTrue'){
        jQuery('#otp').html('Your code is correct');
        
      }
      if(result=='not_exist'){
        jQuery('#otp_error').html('Please enter valid otp');
      }
    }
  });
}

--> if the return is 'yesTrue' that's mean i can go to next page. But it's not working this is call function:

        if(!submit_otp()){
            return;
        }else{
            FrontendBook.updateConfirmFrame();
        }

Question: how can i set up go to next page if the return is 'yesTrue'? Next page is: FrontendBook.updateConfirmFrame(); ==> it's not working when i moved FrontendBook.updateConfirmFrame(); where : jQuery('#otp').html('Your code is correct');

Carmel
  • 13
  • 4
  • Move `FrontendBook.updateConfirmFrame();` to where you have `jQuery('#otp').html('Your code is correct');` – mplungjan Oct 29 '20 at 06:49
  • It should work. What happens? console errors? What does `success:function(result){ console.log(result);` say? – mplungjan Oct 29 '20 at 07:39
  • this way not working. My button call return submit_otp. when i click the button, the validate function must be check the request . – Carmel Oct 29 '20 at 08:30

0 Answers0