javascript - echo alert() in php show everything in the string. octobercms plugin
问题描述
I'm having issue when echoing alert() in php. It show everything in the string.
echo "<script type='text/javascript'>alert('Thank you for your enquiry, we will contact you as soon as possible, have a nice day!');</script>";
解决方案
You can use javascript code between ending and starting php tags like below,
?>
<script type="text/javascript">
alert('Thank you for your enquiry, we will contact you as soon as possible, have a nice day!');
</script>
<?php
// rest of the php code will go here.
?>
OR try this please,
<?php
echo '<script type="text/javascript">';
echo 'alert("Thank you for your enquiry, we will contact you as soon as possible, have a nice day!");';
echo '</script>';
?>
推荐阅读
- python - 我们如何使用动态 SQL 从 Teradata 中提取数据,使用 Python 执行查询?
- mongodb - 在docker中运行nginx和mongodb,如何反向代理到mongodb?
- while-loop - CS50 Pset1/现金。虽然循环不承认平等
- python - 如何使用 Graph API 获取 Facebook 群组发布的所有帖子 ID?
- node.js - 使用jsforce,协商OAUTH2流程后,获取刷新&访问令牌,但不能使用
- google-sheets - Google工作表中重复项的单元格地址和值
- amazon-iam - AWS EKS:无法将 IAM 角色附加到 pod
- firebase - 有没有办法让谷歌云功能知道它在 Firebase 模拟器中运行?
- python - LazyLoadImages 和 Beautifulsoup 网页抓取
- devexpress - GridLookUpEdit 从数据库加载数据