I am trying to send an automatic reply to who uses my contact form using jquery and javascript. The function I have implemented is this
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;
}
I am using nodeJs. The error message points to window
and says reference error window is not defined.
Extra information : When a user clicks the send mail button it will route to a page where a jquery is implemented which will do some function there and if and only if it was successful, im trying to send this above mentioned reply. That is like this,
success: function(message)
{
sendReply(req.body.email,req.body.name);
res.send(304, '/#contact');
}
I've debugged and checks. It passes the parameters correctly and it runs up to the window.location.href=linker;
point.
I've gone through tons of pages and spent hours to find out what is wrong.
I am not an expert in javascript and jquery so if you could point me out my error and the solution, that will be a great help. Thank you.