[英]How to get PHP echo to jQuery popup alert?
I use the below codes for email conformation:我使用以下代码进行电子邮件确认:
using URL: /my_web/back-end/email-verify.php?email=email@gmail.com&code=Vruxc9JQwZEKjbz3HbZ2KlGPX10mJneDmH67hILqFooXeJIQb9使用网址:/my_web/back-end/email-verify.php?email=email@gmail.com&code=Vruxc9JQwZEKjbz3HbZ2KlGPX10mJneDmH67hILqFooXeJIQb9
After the verification how can I get the jQuery to pop up on the index page?验证后如何让jQuery在索引页面上弹出?
Is there any possible way to get PHP echo value to jQuery?有没有可能的方法将 PHP 回声值获取到 jQuery?
if(isset($_GET['email']) && !empty($_GET['email']) AND isset($_GET['code']) && !empty($_GET['code'])){
// Verify data
$email = mysqli_escape_string($conn,$_GET['email']); // Set email variable
$hash = mysqli_escape_string($conn,$_GET['code']); // Set hash variable
$sql="SELECT * FROM users WHERE user_email='".$email."' AND hashid='".$hash."' AND valied_user_1='0'";
$search = mysqli_query($conn,$sql);
if(mysqli_num_rows($search) > 0){
// We have a match, activate the account
$update="UPDATE users SET valied_user_1='1' WHERE user_email='".$email."' AND hashid='".$hash."' AND valied_user_1='0'";
mysqli_query($conn,$update);
echo"success";
}else{
///other echo
}
jQuery Function : jQuery 函数:
$(document).ready(function(){
if(success){
$('#alert').addClass('alert-success alert-dismissible fade show');
$('#alertText').html('Your account has been activated, you can now login.');
$('.modal4').show();
}
});
HTML Modal4 : HTML Modal4 :
<div class="modal4">
<div class="container alert-popup">
<div id="alert" class="alert">
<button type="button" id="alertcloss" class="close">×</button>
<p id="alertText"></p>
</div>
</div>
</div>
Redirect the email_validation.php
to index.php
page with the GET
parameters.使用GET
参数将email_validation.php
重定向到index.php
页面。 http://sample.com/index.php?success=1 and on the index.php page do like http://sample.com/index.php?success=1和在 index.php 页面上做
<div class="modal4">
<div class="container alert-popup">
<div id="alert" class="alert">
<button type="button" id="alertcloss" class="close">×</button>
<p id="alertText"></p>
</div>
</div>
</div>
<?php
if(isset($_GET['success']) {
?>
$(document).ready(function(){
$('#alert').addClass('alert-success alert-dismissible fade show');
$('#alertText').html('Your account has been activated, you can now login.');
$('.modal4').show();
});
<?php
}
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.