I have a form on my site that I would like users to be able to submit without the page reloading. I found this answer which solved that part of it for me, but now I am trying to figure out how I would add success/error messaging to the form upon submit.
Here is my form code:
<iframe name="submit" style="display:none;"></iframe>
<form method="post" action="submit.php" target="submit">
<input type="text" name="firstname" placeholder="First name" />
<input type="text" name="lastname" placeholder="Last name" />
<input type="text" name="email" placeholder="Email address" />
<input type="submit" name="submit" value="" />
</form>
How can I determine whether the form was submitted successfully or not and display a success or error message based on the result? Also open to other suggestions for submitting the form without the page reloading.