title: How to integrate jQuery Validate with my aws lambda function?
body: <p>I want to validate a aws lambda function that I am running in the browser. I want use jQuery validate plugin to validate the input data getting submitted on the webpage. However, I have not been able to get it to work. </p>
  
  <p>Here is my lambda function: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('#contact-form-button').on('click', function (e) {
    AWS.config.update({ region: 'us-east-1' });
    AWS.config.credentials = new AWS.Credentials('&lt;aws credential&gt;', '&lt;aws credential&gt;');
    var lambda = new AWS.Lambda({ region: 'us-east-1', apiVersion: '2015-03-31' }),
      contactName = $('#contact_name'),
      contactEmail = $('#contact_email'),
      contactPhone = $('#contact_phone'),
      contactSubject = $('#contact_subject'),
      contactMessage = $('#contact_message');
  
    /*Feedback Form DynamoDB Table Data*/
    var pullParams = {
      FunctionName: 'grouve-marketing-web-dev-createFeedback',
      InvocationType: 'RequestResponse',
      LogType: 'Tail',
      Payload: JSON.stringify({
        "feedback_id": makeid(),
        "name": $(contactName).val(),
        "email": $(contactEmail).val(),
        "phone": $(contactPhone).val(),
        "subject": $(contactSubject).val(),
        "message": $(contactMessage).val()
      })
    };
  
  
    lambda.invoke(pullParams, function (error, data) {
      if (error) {
        prompt(error);
      } else {
        pullEmailResults = JSON.parse(data.Payload);
      }
    });
    var pullEmailResults;
  
    return false;
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is my jquery validate code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> $('#contact_form').validate({
          rules: {
              "contact_email": {
                  required: true,
                  email: true
              },
              "contact_phone": {
                  required: true,
                  phoneUS: true
              }
          },
          messages: {
               "contact_name": {
                  required: "nter your name"
              },
              "contact_email": {
                  required: "Enter a valid email"
              },
              "contact_phone": {
                  required: "Enter a valid phone number"
              },
              "contact_subject": {
                  required: "Enter a subject"
              },
              "contact_message": {
                  required: "Enter your message"
              }
          }      
      });</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have tried to use the <code>success:</code> and <code>submitHandler</code> methods but neither work. And I cannot run validate outside the <code>click</code> event. So what can I do?</p>