我只是需要一些帮助。我想在我的索引上显示成功消息,但前提是有人来自发送电子邮件的php页面。
这就是我所拥有的
<script>
function load()
{
if (document.referrer == 'http://www.blahblah.com/contact-form-handler.php') {
$.notify.success('We read you loud and clear; message received. Prepare for reply.', {
autoClose : 3000
});
}
}
</script>
</head>
<body onload="load()">
这有效:
<script>
function load()
{
$.notify.success('We read you loud and clear; message received. Prepare for reply.', { autoClose : 3000 });
}
</script>
</head>
<body onload="load()">
所以if语句显然有问题。有人可以帮助我吗?
答案 0 :(得分:1)
使用带有.match()
function load()
{
if (document.referrer.match(/\/contact-form-handler.php/)) {
$.notify.success('We read you loud and clear; message received. Prepare for reply.', {
autoClose : 3000
});
}
}