Easy Codes To Submit A Form Without Refreshing Page With jQuery And Ajax

Here I will be showing you very simple tips for submitting HTML form values without refreshing page using jQuery and Ajax codes. Just input these codes and enrich your web applications easily.
Read Also:
1. How To Make a Calculator In Java With Source Code
2. Tutorial About Changing Design Colors With Jquery Codes
3. Java Source Code For Simple Animation Making With Swing

Submit a Form without Refreshing page with jQuery and Ajax

Form Without Refreshing Page With jQuery And Ajax

For making this form you need three type of programs JavaScript Code,  HTML Code,  join.php;

JavaScript Code

jQuery and Ajax script take a look at dataString. Codes are below;

<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/
<script type=”text/javascript” >
$(function() {
$(“.submit”).click(function() {
var name = $(“#name”).val();
var username = $(“#username”).val();
var password = $(“#password”).val();
var gender = $(“#gender”).val();
var dataString = ‘name=’+ name + ‘&username=’ + username + ‘&password=’ + password + ‘&gender=’ + gender;

if(name==” || username==” || password==” || gender==”)
type: “POST”,
url: “join.php”,
data: dataString,
success: function(){
return false;


<form method=”post” name=”form”>
<input id=”name” name=”name” type=”text” />
<input id=”username” name=”username” type=”text” />
<input id=”password” name=”password” type=”password” />
<select id=”gender” name=”gender”> 
<option value=””>Gender</option>
<option value=”1″>Male</option>
<option value=”2″>Female</option>
<div >
<input type=”submit” value=”Submit” class=”submit”/>
<span class=”error” style=”display:none”> Please Enter Valid Data</span>
<span class=”success” style=”display:none”> Registration Successfully</span>


mysql_query(“SQL insert statement…….”);
}else { }


Just input the programs and enjoy this tutorial for about making a form with jQuery and Ajax. If you have any question of this post ask me via the comment section. Share it if you like with your buddies in social media.

Leave a Comment