[Solved] Calling a php script at the end of a js script


You should submit the form. (or use JavaScript to valid the form then submit it)

<form id="email_form">
    <input name="name">
    <input type="submit" id="submit_btn">
</form>

Then mail.php will get the information, and you can do whatever you want there.

ADDED

To submit a form in JavaScript:

document.querySelector("#submit_btn").addEventListener("click",function(e){
    var form = document.querySelector("#email_form");  //Select the form
    form.submit();                            //Submit it (very self-explanatory)
    e.preventDefault();
},false);

1

solved Calling a php script at the end of a js script