Insert data in Database Using Jquery

-Insert data in Database Using Jquery -Create a index.php and code.php file with code -database name 'school' -tabale Name 'class' -thene Working it code File Name :- index.php

<script type="text/javascript" src="jquery.js"></script>  //Install Jquery
<script type="text/javascript">
alert("Enter first name");
return false;
} else
var fname = $('#fname').val();
alert("Enter Password");
return false;
var password = $('#passwd').val();
}"code.php", {
pass: password
},  function(data, textStatus){
if(data == 1){
$('#response').html("Registration successfull!!");
$('#response').html("Some Error Occurred");
<div id="form">
<label>Name :</label>
<input type="text" id="fname" />
<br />
<br />
<label>Password :</label>
<input type="password" id="passwd" />
<br /><br/>
<input type="button" id="button" value="Insert" /><br />
<label id="response"></label>

  Create Filename :- code.php

$connection = mysql_connect('localhost', 'root', '')  or die("Opps some thing went wrong");  //connection establis hear
$db = mysql_select_db('school', $connection) or die("Opps some thing went wrong");
$name = $_POST['firstname'];
$password = $_POST['pass'];
$encrypted = md5($password); // Encrypting pssword using md5 algo
$query=mysql_query("INSERT INTO class(`name`,`password`) VALUES('$name','$encrypted')");  //insert data in database
echo "1";
echo "2";