jQuery Validation remote option does not work

jQuery Validation remote option does not work

Hello,

I am trying to use the remote option in jQuery to perform a server side validation. I am able to get the client side validation correctly. 

I want to call serverside method checkRoiRequired which returns JSON true or false based on 3 parameters: analysthours, engineerhours and projectid. I have gone through numerous posts; but nothing has worked yet.

When the form is submitted, the validation never occurs; there is no log found that the method is called. Please help me out with the following. 

  1. $(document).ready(function() {

  2. // validating the form
  3. $("#command").validate({
  4.   rules:{
  5. "projHeader.roiAttachmentLink": {
  6. remote:{
  7.                  url: "../project/checkRoiRequired.do" ,
  8.   data: {
  9. revAnalystHour: function() { return $("#reAnalystHours").val(); },
  10. revEngineerHour: function() { return $("#reEngineerHours").val(); },
  11. projectId: function() { return $("#projectId").val(); }
  12. }
  13. }
  14.  }
  15.    },
  16. messages:{
  17.   "projHeader.roiAttachmentLink": {
  18.              remote:"ROI attachment link is required"
  19.   }
  20.     },
  21. errorElement: "div",
  22.                         wrapper: "div",  // a wrapper around the error message
  23.                   errorPlacement: function(error, element) {
  24.            offset = element.offset();
  25.            error.insertBefore(element)
  26.            error.addClass('message');  // add a class to the wrapper
  27.            error.css('position', 'absolute');
  28.            error.css('left', offset.left + element.outerWidth());
  29.            error.css('top', offset.top);
  30.      }
  31. });  
  32. });

When I use the required : true option in above rules, it works fine.