title: Use ajax validation with javascript submit in nyroModal modal window
body: <p>I have a form (signup.php) that pops up in a nyroModal window when I click a button:</p>
  
  <pre><code>&lt;input value="Edit" class="nyroModal" type="button" href="signup.php"&gt;
  </code></pre>
  
  <p>I would like to use some form of AJAX validation (to check if the user name has been taken, for example) before submitting the form. </p>
  
  <p>I had the following in mind: When the user clicks the 'submit' button. it calls javascript function with <code>onClick</code> that sends the required fields to a PHP script, which returns whether the fields are valid. Then, if the field is invalid, it notifies the user, but when the field is valid, it submits the form via something like <code>$('#formid').submit();</code>. Easy enough in theory.</p>
  
  <p><strong>BUT</strong></p>
  
  <p>Problem is, when the nyroModel gets the new form from a URL, and creates a div in the DOM with the contents in it, Firefox completely ignores any <code>&lt;script&gt;</code> tags. Using Firebug, I can see it actually gets the <code>&lt;script&gt;</code> tags with the response, but Firefox ignores them. Also, I can't create a jQuery function on the page that the model is called from, because when the document is created, the form doesn't exist in DOM yet.</p>
  
  <p>Any ideas how to solve this?</p>