title: OctoberCMS using Ajax API with no-script fallback in page php section
body: <p>My current base for a simple contact form is:</p>
  
  <p>A page containing the form and the form validation in the php section with a native function like so:</p>
  
  <pre><code>function onStart(){if(Request::isMethod('post')) /* do stuff */}
  </code></pre>
  
  <p>Above is my "no-script" solution.</p>
  
  <p>Now, when I want to enable OctoberCMS' Javascript API I have to call a self defined function in the php section, for example:</p>
  
  <pre><code>function onSubmit(){/* do stuff */}
  </code></pre>
  
  <p>How could I combine both in one function so that <code>/* do stuff */</code> triggers, regardless if the request was send via Ajax or pure php?</p>