Problem with AJAX

Problem with AJAX

Hello, I am trying to make an AJAX script work, please tell me what I am doing wrong here 
This here's the JQuery/HTML part
  1. <html>
  2. <head>
  3. <script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js" type="text/javascript"></script>
  4. <script type="text/javascript">
  5. $(document).ready(function(){ 
  6. $("#submit").onClick(function(){ 
  7. $.post("chsend.php", {
  8. name: $("#name").val();
  9. email: $("#email").val();
  10. msg: $("#msg").val();},
  11. function(data){
  12. alert(data);
  13. if(data == "name" || data == "email" || data =="wrongemail"){
  14. $("#change").addClass("red");
  15. if(data == "empty"){
  16. $("#change").append("Please fill the email and name fields properly <br />");
  17. }
  18. elseif(data == "wrongemail"){
  19. $("#change").append("Invalid email id <br />");
  20. }
  21. elseif(data == "emptywrongemail"){
  22. $("#change").append("Please fill the name field completely and the email field properly.");
  23. }
  24. }
  25. elseif(data == "success"){
  26. $("#change").addClass("green");
  27. $("#change").append("We were succesful in adding your name in our list! Thank You.");
  28. }
  29. });
  30.    });
  31. });   
  32.   
  33. </script>
  34. </head>
  35. <body>
  36. <div class="change">
  37. <form id="subfor">
  38. Full Name:<input type="text" id="name" /><br />
  39. Email ID:<input type="text" id="email" /></br />
  40. Message You would like to send:<input type="text" id="msg" /><br />
  41. <input type="button" id="submit" value="Submit" /><br />
  42. </form>
  43. </div>
  44. </body>
  45. </html>

Here is the PHP code

  1. <html>
  2. <body>
  3. <?php
  4. $name=htmlspecialchars(filter_var($_POST["name"],FILTER_SANITIZE_SPECIAL_CHARS));
  5. $email=filter_var($_POST["email"], FILTER_SANITIZE_SPECIAL_CHARS);
  6. $msg=htmlspecialchars(filter_var($_POST["msg"],FILTER_SANITIZE_SPECIAL_CHARS));
  7. if(empty($name)){
  8. $s="empty";
  9. if(!empty($email)){
  10. if(!filter_input($email, FILTER_VALIDATE_INPUT)){
  11. $s=$s."wrongemail";
  12. }
  13. }
  14. }
  15. else if(filter_input($email, FILTER_VALIDATE_INPUT)){
  16. $con=mysql_connect("localhost","root");
  17. if(!$con){
  18. die('Could not Connect:'.mysql_error());
  19. }
  20. mysql_select_db("projects", $con);
  21. mysql_query("INSERT INTO pat(NAME, EMAIL, MESSAGE) VALUES($name, $email, $msg)");
  22. $subject="<TEST>";
  23. mail($email,$subject,$msg);
  24. $s="success";
  25. }
  26. echo($s);
  27. ?>
  28. </body>
  29. <html>
  30. <body>
  31. <?php
  32. $name=htmlspecialchars(filter_var($_POST["name"],FILTER_SANITIZE_SPECIAL_CHARS));
  33. $email=filter_var($_POST["email"], FILTER_SANITIZE_SPECIAL_CHARS);
  34. $msg=htmlspecialchars(filter_var($_POST["msg"],FILTER_SANITIZE_SPECIAL_CHARS));
  35. if(empty($name)){
  36. $s="empty";
  37. if(!empty($email)){
  38. if(!filter_input($email, FILTER_VALIDATE_INPUT)){
  39. $s=$s."wrongemail";
  40. }
  41. }
  42. }
  43. else if(filter_input($email, FILTER_VALIDATE_INPUT)){
  44. $con=mysql_connect(<SQL server>,<username>,<password>);
  45. if(!$con){
  46. die('Could not Connect:'.mysql_error());
  47. }
  48. mysql_select_db("projects", $con);
  49. mysql_query("INSERT INTO pat(NAME, EMAIL, MESSAGE) VALUES($name, $email, $msg)");
  50. $subject="<TEST>";
  51. mail($email,$subject,$msg);
  52. $s="success";
  53. }
  54. echo($s);
  55. ?>
  56. </body>
  57. </html>
The  Jquery script, on alerting the value of data, returns nothing. Nothing occurs at all.