gpt4 book ai didi

javascript - 如果响应有效则显示 window.alert

转载 作者:行者123 更新时间:2023-12-03 12:05:17 27 4
gpt4 key购买 nike

嗯...我尝试过这个:

if ($resp->is_valid) {
@mail($email_to, $email_subject, $email_message, $headers);
print "<script language="javascript">
window.alert("'Thank you for submitting the track. We will be in touch with you very soon. Click 'Ok' to redirect you to the Homepage.'")
window.location.href='http://www.xmasterofficial.tk/'
</script>";
} else {
echo "Sorry cannot send email as you've failed to provide correct captcha! Try again...";
}

不知道问题出在哪里。如果 $resp 有效,它应该创建一个 window.alert ;如果无效,它应该发布一条消息。 window.alert 没有显示。

最佳答案

该代码在 print 语句中使用引号时存在一些问题。在处理多个字符串时,请使用 echo 而不是 print 。并且您需要单独处理引号要实现此目的,这必须帮助您使用警报选项。

if ($resp->is_valid) {
@mail($email_to, $email_subject, $email_message, $headers);
echo "<script language='javascript'>
window.alert('Thank you for submitting the track. We will be in touch with you very soon. Click Ok to redirect you to the Homepage.')
window.location.href='http://www.xmasterofficial.tk/'
</script>";
} else {
echo "Sorry cannot send email as you have failed to provide correct captcha! Try again...";
}

关于javascript - 如果响应有效则显示 window.alert,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25215434/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com