Newbie jquery validate - Validation with ajax submission using plugin

Newbie jquery validate - Validation with ajax submission using plugin

Hello,

I can't get the success message and the submission to happen with ajax:

On myValidation.js I have:
  1. $('#form-contactos').validate({
  2.    rules: {
  3.      txtResponsavel: "required",
  4.      txtEmail: {
  5.        required: true,
  6.        email: true
  7.      },
  8.      txtMensagem: "required"
  9.    },
  10.    errorPlacement: function(error, element) {
  11.        error.insertAfter(element);
  12.    },
  13.    submitHandler: function(form)
  14.    {
  15.     jQuery(form).ajaxSubmit(
  16.         {
  17.             target: "#resultado",
  18.             success: function()
  19.             {
  20.                 $('#resultado').fadeIn('slow')
  21.             }
  22.     });
  23.     }
  24.  
  25. });
My form on the HTML file is as follow:

  1. <form id="form-contactos" action="<?php echo filter_var($_SERVER['PHP_SELF'], FILTER_SANITIZE_STRING); ?>" method="post">
  2. ...
  3. <div id="resultado" style="background-color: red;">
  4.  <!--hoping to appear some server side message here. :( --></div>
  5. ...
  6. <!-- js loading at the end of the body tag.-->
  7.     <script type="text/javascript" src="Js/ValidacaoForm/lib/jquery.js"></script>
  8.     <script type="text/javascript" src="Js/ValidacaoForm/myValidation.js"></script>
  9.     <script type="text/javascript" src="Js/ValidacaoForm/lib/jquery.form.js"></script>

What am I doing wrong?


Thanks in advance,
Márcio