ajax form submit problem

ajax form submit problem

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <script type="text/javascript" src="jquery-1.4.2.js"></script>
  6. <script>
  7. $(document).ready(function(){
  8.      $('#form1').live('click',function(){
  9.             $.post('submit.php', $('#form1').serialize(), function(data){
  10.                  $('#modalkast').empty().append('<br />'+data);
  11.                 $('#form1 input[type=text]').val('');
  12.                 $('#form1 input[type=password]').val('');
  13.                 $('#form1 input[type=textarea]').val('');
  14.                 $('#form1 input[type=checkbox]').removeAttr('checked');
  15.                 $('#form1 input[type=radio]').removeAttr('checked');
  16.                
  17.           });
  18.      });
  19. });
  20. </script>
  21. <title>Untitled Document</title>
  22. </head>
  23. <body>
  24. <form action="#" method="post" id="form1">
  25.   mingi tekst <input type="text" name="field" id="field" /><br />
  26.     <input type="checkbox" name="field2" /> siin checkime<br /><br />
  27.   <input type="button" value="send" />
  28. </form>
  29. <br /><br />
  30. <form action="olematu.php" method="post">
  31. <input type="text" name="kala" />
  32.   <input type="submit" value="olematu" />
  33. </form>
  34. <div id="modalkast"></div>
  35. </body>
  36. </html>

the problem is that the form is submitted even when clicked on input text field or checkbox. how to fix it? and is there a better way to reset a form? also i would like all other forms act as normal ones!