Ajax email contact form without refreshing page in html

If you like this post, Then please share it with your friends, so that they can also enjoy the article:

I got some email regarding this problem "How to send Ajax email contact form without refreshing page in html" , so I decided to share very simple tutorial to solve such problem with simple concept. If you don't want to read article then no worry you can download source code from bottom of article. But if you want to know all the process behind it then, Let's start-

submit email form without refreshing page in html

Demo
Step 1- Create 2 files one is in .html and second one is .php (html file for contact form and PHP file for email route setup).

Simple Form Code :

Step 2 - Open your html & mail.php and paste above form code or you can use your own contact form input area and html.

Step 3 - Create id for each input as you see in my form field, there are three input, name , email & message. (id because we call ajax from such ids)

Step 4- Check below jquery code, give small attention you can know everything easily.

Clearing Doubt Of Above Ajax Html Email Contact Form:

First we click on button and it would be "#submitBtn" and after that I'm getting value of every id of form.

After that I'm creating data string and sending via ajax to mail.php.

After success retrieving data in id "#feedback" (Here response from mail.php will be displayed).

You should remember :

Ajax script should in head and you need Live server to run php server self mail function.

Everything done. Let me know if anything else or you have any query.

Download Source Code

* If this Helped you! Please take a Second to like and share it. *

Himanshu is young engineer living in India. Currently working in BOLD.com as UI Engineer. He is an ethical hacker & blogger too. Doing lot's of crazy stuff... If you seems interesting, go through portfolio: www.himstar.info

Leave a reply:

Your email address will not be published.

Sliding Sidebar

We have 20,000+ active geeks


We are team of ' Delhi Startups ' , most active startup community with strict spam policy.
We are making !deas happen..for future, business and jobs without charging anything, with connecting entrepreneurs.. It's a reason to trust on us.
Come and join or subscribe, we will defiantly give a reason to like us.

Our Facebook Page