Hi guys,

In my register page, I have a button that uses ajax to validate and send an email of confirmation. Trouble is the sendmail function takes about 3-4 seconds, and whilst it is sending the user may click the button twice or three times because it doesn't look like it is working.

What is the best way to handle this? Should I avoid using ajax and just do a simple form submit or is there a better way?


4 Years
Discussion Span
Last Post by Topnews

As soon as the button is clicked, disable the button in the function that uses AJAX. The sendmail script should echo a status 0/1 so that you can know if mail was successfully sent or not. You can check if it was sent or not from the response text in AJAX. If it was not sent you can redirect to a resend mail page or you can change the button to resend verification mail.

Edited by tapananand

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.