title: Run jQuery within PHP
body: <p>I have a form where I have the blockUI jQuery plugin getting called immediately when I press the submit button, which in turn causes a div with a "Loading.." animation to play in it. </p>
  
  <p>The problem is that this Loading animation is triggered upon pressing the submit button, and if there are any validation issues with the form, if validation doesn't pass, the form actually doesn't submit but the loading div shows up anyways. </p>
  
  <p>So, I think I need to trigger the blockUI only AFTER the form has passed validation. </p>
  
  <p>I am using Wordpress plugin called Ninja Forms to submit and process the form. The documentation for Ninja Forms has this action which I think I need to utilize:  <a href="http://ninjaforms.com/documentation/developer-api/actions/ninja_forms_process/" rel="nofollow">http://ninjaforms.com/documentation/developer-api/actions/ninja_forms_process/</a></p>
  
  <p>I think I can use this ACTION to run blockUI only AFTER validation passes. </p>
  
  <p>So I have this code below. But this doesn't seem to be working. The blockUI doesn't run at all now even if validation passes. So maybe I'm not triggering the jQuery to run correctly?</p>
  
  <pre><code>&lt;?php
  
  add_action( 'init', 'ninja_forms_register_example' );
  function ninja_forms_register_example(){
  add_action( 'ninja_forms_process', 'ninja_forms_example' );
  }
  
  function ninja_forms_example(){
  global $ninja_forms_processing;
  
      echo "&lt;script&gt; $(document).ajaxStart(function(){ $.blockUI({ message: $('#rLo') }); });     &lt;/script&gt; "; 
  }
  
  ?&gt;
  </code></pre>