title: Passing a variable to JQuery submit function?
body: <p>So I have this:</p>
  
  <pre><code>$('#id').submit(function(e){
      e.preventDefault();
      etc etc
  </code></pre>
  
  <p>I want to be able to have this:</p>
  
  <pre><code>$('#id' + variable).submit(function(e){
      e.preventDefault();
      etc etc
  </code></pre>
  
  <p>I'm not sure what I should do to go about that. The reason for it is that there are many similar forms on the page that get generated dynamically.</p>
  
  <p>I tried doing this and I'm guessing that is just a terrible thing to do but it was all I could think to try as I am not very good with JQuery:</p>
  
  <pre><code>function foo(variable){
      $('#id' + variable).submit(function(e){
      e.preventDefault();
      etc etc
  }
  </code></pre>
  
  <p>But that causes the form to be submitted multiple times.</p>
  
  <p>-edit- to respond to a request:</p>
  
  <pre><code>$.ajax({  
      type: "POST",  
      url: "process.php",  
      data: dataString,  
      success: function(data) { 
  
              var responseData = jQuery.parseJSON(data),
              etc etc do some stuff like show a message (all that works)
  </code></pre>