I have a long piece of Java script code and I need to add Email action in the middle of the code. However, I know that I cannot directly send Email with Java script so I used :
$.ajax({
type:"post",
url:"mail.php",
success:function(){
alert("it was a success");
}
});
window.location = url;
}
});
inside of my mail.php file I have very simple Email tag which is :
<?php
//send email
mail('test@gmial.com','My Subject' , 'test');
?>
However it says "it was success" on JS but it does not do anything on PHP. I even tried to print something on PHP but it does not work. Any idea??