用户电子商务帐户激活。 PHP、jQuery

问题描述 投票:0回答:1

我希望当用户登录其电子商务帐户时,应显示购物车图标,如果用户未登录,则不应显示该图标。 PHP、Jquery

 $.post('/controller/user.php', { request: "login", password, username }, function (response) {
                // covert json string resp to js obj
                response = JSON.parse(response);
                if (response.status == "success") {
                    customAlert("Account login successfully", "success", 3000);
                    setTimeout(() => {
                        document.location = "/";
                    }, 1500);
                } else {
                    customAlert(response.message, "error", 3000);
                }
            }).fail(function () {
                return customAlert("could not send request, kindly check your internet connection", "error", 3000);
            })

使用此代码,用户可以从注册页面登录,但我的是在主页上不会发送用户名和 ID 来验证它


这是我希望在用户使用该帐户时激活的图标。

 <?php 
                          
                            if(isset($_POST['username']))
                            { echo'<a href="#" class="single-icon"><i class="ti-bag"></i> <span class="total-count">2</span></a>';}else{
                                echo'';
                            }
                            ?>
php html jquery mysql phpmyadmin
1个回答
0
投票

我认为你需要调试你的

$POST
变量。也许会有
$POST['data']['username]

注意:需要调试代码。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.