<html>
<head>
  <title>Simple jQuery and PHP Square Root example</title>
  <script src="js/jquery-1.4.2.js" type="text/javascript"></script>
 <script type="text/javascript"> 
 $(document).ready(function() {
  $('#form').submit(function(){
  var number = $('#number').val(); 
  $.ajax({type:"post",url:"calculate.php",data:"number=" 
  +number,success:function(msg){$('#result').hide(); 
  $("#result").html("<h3>" + msg + "</h3>").fadeIn("slow"); } });
  return false;
});
});
</script>
</head>
<body>
<form id="form" action="calculate.php" method="post">
  Enter number:
  <input id="number" type="text" name="number" />
  <input id="submit" type="submit" value="Calculate Square Root" 
  name="submit"/>
</form>
<p id="result"></p>
</body>
</html>