title: Send AJAX email by calling a function
body: <p>Following is my js function from which i have been trying to send an email from my contact form, I used validation checks which are working fine but when the code goes to send the form then the process stops there and receives no responce from <code>$.ajax</code>. Strangely when i used the very same code on click event <code>$('#send_message').click(function(e){</code> it worked fine but not when i removed the click trigger listen and tried to do via calling a function then it didnot work kindly let me know what i did wrong so i can fix the issue of sending email by calling a function</p>
  
  <pre><code> $.ajax({
                      type:"POST",
                      url:"email.php",
                      data: $("#contact").serialize(),
                      success:function(result){
                          //alert(response);
                          if(result == 'sent')
                          {
  
                               $('#send_message').removeAttr('disabled').attr('value', 'Send Info');
  
                              //and show the mail success div with fadeIn
  
                          }
                          else
                          {
  
                              //show the mail failed div
  
  
                          }
                       }
  
                  });
  </code></pre>