window.location.href窗口未在javascript中定义

时间:2016-04-05 06:53:35

标签: javascript node.js email mailto

我正在尝试使用jquery和javascript向谁使用我的联系表单发送自动回复。我实现的功能就是这个

Directives

These can be set from play to task level, but are overriden by connection variables as they can be host specific.

become
set to ‘true’/’yes’ to activate privilege escalation.

become_user
set to user with desired privileges, the user you ‘become’, NOT the user you login as. Does NOT imply become: yes, to allow it to be set at host level.

become_method
at play or task level overrides the default method set in ansible.cfg, set to ‘sudo’/’su’/’pbrun’/’pfexec’/’doas’

Connection variables
Each allows you to set an option per group and/or host, these are normally defined in inventory but can be used as normal variables.

ansible_become
equivalent of the become directive, decides if privilege escalation is used or not.

ansible_become_method
allows to set privilege escalation method

ansible_become_user
allows to set the user you become through privilege escalation, does not imply ansible_become: True

ansible_become_pass
allows you to set the privilege escalation password

我正在使用nodeJs。错误消息指向 function sendReply(email,Name) { var linker = "mailto:"+email + "?cc=myCCaddress@example.com" + "&subject=" + escape("automated Reply") + "&body=Hello "+Name+" Thank you for your e-mail. we will contact you soon."; window.location.href=linker; } ,并且未定义参考错误窗口。

额外信息:当用户点击发送邮件按钮时,它将路由到实现jquery的页面,该页面将在那里执行某些功能,当且仅当它成功时,我试图发送上述回复。 就像这样,

window

我已经过调试和检查。它正确传递参数,并且运行到 success: function(message) { sendReply(req.body.email,req.body.name); res.send(304, '/#contact'); } 点。 我已经浏览了大量的页面,花了几个小时来找出问题所在。 我不是javascript和jquery的专家,所以如果你能指出我的错误和解决方案,那将是一个很大的帮助。谢谢。

1 个答案:

答案 0 :(得分:0)

有用吗?

function sendReply(email,Name,res)
{
            var linker = "mailto:"+email
                 + "?cc=myCCaddress@example.com"
                 + "&subject=" + escape("automated Reply")
                 + "&body=Hello "+Name+" Thank you for your e-mail. we will contact you soon.";

            //window.location.href=linker;


            res.writeHead(301,
                         {Location: linker}
                         );
            res.end();
}