jQuery Alert Fade Out Message after form submit

0 293


In this, tutorial we will see about how to code a message that fades out using jQuery. After jQuery AJAX form submits, we have to respond the user with a fade-in fade-out message. We have already seen the jQuery fading effects on the mouse over event of HTML image elements.

We have an example with an HTML form containing two required fields. The AJAX code validates the form and sends its inputs to PHP. The PHP script responds the AJAX script with a success message. This message will be fade in/out using jQuery.

HTML Code for jQuery AJAX Form

This code is to show an AJAX form containing name and comment fields. These two values should not be empty and it is validated using jQuery.

jQuery Fade Out Message on Form Submit

We have a script to submit the HTML form via jQuery AJAX. This script prevents form’s default submit action and call AJAX to get input from form fields. These inputs will be validated and passed to the server side.

If the server-side PHP file receives these inputs, then a success response will be fade in. And then, this response text will be fade out after some time by using Javascript setTimeOut(). We are using jQuery fading methods for showing AJAX response with fade-in fade-out effect. And the code is,


You might also like More from author

Leave A Reply

Your email address will not be published.