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">

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


To submit a form in JavaScript:

    var form = document.querySelector("#email_form");  //Select the form
    form.submit();                            //Submit it (very self-explanatory)

Browse More Popular Posts

Leave a Comment