Ajax form submission is better and fast way to submit form without page loading .It's make a nice experience to your users.
Below we have written a tutorial on how to submit a form with jquery ajax . You can also consider this as a PHP, ajax registration form .
First of all we have to create a html file ,with below html codes
Above we have a form to get user data . There also 2 div containing classes loading and message for handling loader images show and success message display . Now include your jquery file and put below code above the html as shown below
Above we have stored ajax loader image on a variable 'loader'. When user click submit button we have shown this loader to the div class 'loading' . Then we read all user's entered data to variables name, email, password, contact, address . we have created an ajax request to send user's entered data to a file 'ajax/process.php' and handle it's output . If output 1 , we have considered success .So, fade out the form ,loader and shown message to div class 'message' .
Now , lets create a folder 'ajax' the file 'process.php' in it .
We have a database config file as shown below
Above we have a form to get user data . There also 2 div containing classes loading and message for handling loader images show and success message display . Now include your jquery file and put below code above the html as shown below
Above we have stored ajax loader image on a variable 'loader'. When user click submit button we have shown this loader to the div class 'loading' . Then we read all user's entered data to variables name, email, password, contact, address . we have created an ajax request to send user's entered data to a file 'ajax/process.php' and handle it's output . If output 1 , we have considered success .So, fade out the form ,loader and shown message to div class 'message' .
Now , lets create a folder 'ajax' the file 'process.php' in it .
We have a database config file as shown below
We just included Database config file , read user's data in post method , finally inserted it to db table then echo .
I think this tutorial will guide you for jquery, ajax form submission with PHP,Mysql Database . If you have any query ,do write it in below comments .I try my best to
reply all your questions .