简体   繁体   中英

mysql popup forgot password

I have a form forgot password that confirms if the user exists and send a email with a link for password reset, it works fine but i do like that message "email was been sent..." should appear in a popup instead on the same page.

I tried this but does not works:

response.php

var useremail = document.getElementById("email").value();
$.get( "validation.php?email="  function( response ) {
    // console.log( response ); // server response
    response = response.trim();
    if(response == 1){
        alert("Email sent....");
    } else{
        alert(response);
        return false;
    }
});

}`

Form:

<form class="register" id="email" action="forgot.php" method="post" onSubmit="checkAll();">

mysql

if ($result=="") { $result = "Email has been sent"; }
  echo "<div>$result</div>";
}
?>```

I have sorted all and now it works i let here the solution in a hope that can helps someone else:

function alert(){
  echo "<script type='text/javascript'>";
  echo "alert('Email has been sent - Please click on the link in the email to confirm.');";
  echo "</script>";
  }
  
  


 
    if ($result=="") { $result = alert(); }
    }

?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM