Simple jQuery Ajax Contact Form Without Page Refresh

Hi, Today i am going to show you basic example of how to submit any form without page refresh, Actually it is very easy using jquery .serialize() and .ajax() function.

It doesn’t matter how many field’s in your form using this keyword you can serialize all your form data and send it to server using .ajax() function.


See below html page with some jquery script.

contact.html







Simple jQuery Ajax Contact Form Without Page Refresh



Contact Form

Now time to create your server file name contact.php in this page all form data will receive. using $_REQUEST function in php.

contact.php


In contact.php page you can write code for sending form data in email or your mysql database as per your need.

By using firefox FIREBUGaddon you can check that your post data and response from server is right way or not.
contact-form
Below demo i have creted to sending email in nodejs here the only thing changed is server part here i am using nodejs in server side for sending mail, But client part is same as i explained above.

If you like this post please don’t forget to subscribe My Public Notebook for more useful stuff.