Member Avatar for iamthwee

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?

Ta.

Disable the button (while processing).

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.

Member Avatar for iamthwee

I think I'll go for a simple form submit like Daniweb's sign up. Seems easier.

This discussion has helped me. I like it.
thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.