亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

window.location.href無法與sweetalert一起使用

window.location.href無法與sweetalert一起使用

PHP
冉冉說 2021-05-05 21:58:13
我正在使用html和php創建表單,提交表單后,我想用sweetalert顯示成功消息,并希望將窗口定位到另一個頁面。我嘗試了以下代碼,但沒有用。請告訴我我要去哪里了echo '<script type="text/javascript">';echo 'setTimeout(function () {';echo 'swal("Success!","Your complaint has been successfully registered.\n Your Customer Complaint No. is\n  "+"'.$complainno.'","success")    .then( function(val) {  if (result.value) {        window.location = "/cashier.php";    }';             echo '});';echo '}, 200);  </script>';
查看完整描述

1 回答

?
慕尼黑8549860

TA貢獻1818條經驗 獲得超11個贊

這是解決方案:


echo '<script>

        setTimeout(function() {

            swal({

                title: "Success!",

                text: "Your complaint has been successfully registered.Your Customer Complaint No. is"+$complainno,

                type: "success"

            }, function() {

                window.location.href = "cashier.php"; // window.location also can be used

            });

    }, 1000);

</script>';


查看完整回答
反對 回復 2021-05-28
  • 1 回答
  • 0 關注
  • 240 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號