title: Javascript callback from form attribute
body: <p>I have setup some automatic form submission code. Basically when a form is submitted javascript takes care of it, finding all inputs and such, and sending the data via ajax to the action attr of the form.</p>
  
  <pre><code>$j('body').delegate('form', 'submit', function(e) {
      e.preventDefault();
      if($j(this).prop('data-callback', true))
          asf.forms.processForm($j(this).attr('name'), $j(this).attr('data-callback'));
      else
          asf.forms.processForm($j(this).attr('name'));
  });
  </code></pre>
  
  <p>But i need to include callbacks. I need to make the code global so i cant code any specifics for each form. So i thought of adding an attribute with the callback function name like so:</p>
  
  <pre><code>&lt;form action="" method="" data-callback="posts.addPost()"&gt;
  </code></pre>
  
  <p>The problem is I dont know how to fire that function inside javascript. Any ideas?
  I cant use onsubmit because i need access to all of the forms information which means doing this callback within the ajax response.</p>
  
  <p>Thanks</p>