title: Would submitting a form using Ajax be secure?
body: <p>So I have my form built in html and validated in JS and it does and looks the way I want.  Now obviously I will be validating the input using PHP on the server side but I'm wondering if it would be secure enough to submit the form using Ajax and then validating on the server side, instead of submitting the form using a 'submit' type button and an 'action' attribute.  Basically, is it safe to make server side validation dependent on the JS submitting it?</p>
  
  <p>Here is my form:</p>
  
  <pre><code>&lt;form name="contactForm" id="contactForm"&gt;&lt;!-- The form has no action attribute because its submitted via Ajax --&gt;
  &lt;div id="inputsWrapper"&gt;
      &lt;div&gt;
          &lt;label for="fullName"&gt;Your Name: &lt;span class="required"&gt;(required)&lt;/span&gt;&lt;/label&gt;
          &lt;input type="text" name="fullName" id="fullName" title="First &amp;amp; last name" value="First &amp;amp; last name" maxlength="50" /&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;label for="email"&gt;Your E-mail: &lt;span class="required"&gt;(required)&lt;/span&gt;&lt;/label&gt;
          &lt;input type="text" name="email" id="email" title="E-mail address" value="E-mail address" maxlength="500" /&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;label for="subject"&gt;In Regards To: &lt;span class="required"&gt;(required)&lt;/span&gt;&lt;/label&gt;
          &lt;input type="text" name="subject" id="subject" title="Subject" value="Subject" maxlength="50"/&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;label for="message"&gt;Your Message: &lt;span class="required"&gt;(required)&lt;/span&gt;&lt;/label&gt;
          &lt;textarea name="message" id="message" title="Enter your message here" cols="40" rows="10"&gt;Enter your message here&lt;/textarea&gt;
      &lt;/div&gt;
  &lt;/div&gt; &lt;!-- End inputsWrapper --&gt;
  &lt;input type="button" name="sendBtn" id="sendBtn" value="Send Message" /&gt;&lt;!-- This button has a listener assigned to it in JS and submits the form on click --&gt;
  </code></pre>
  
  <p></p>
  
  <p>Once the button is clicked, the Ajax will submit the form via POST to my PHP script and either come back valid or not.  Would this be a safe way of doing this or not?  Thank you for any advice.</p>