title: How to use dynamic data name with jQuery.post?
body: <p>I have 2 basic form used to convert data (type 1 &lt;-> type 2).</p>
  
  <p>I want to do my .post request using only 1 form. </p>
  
  <p>I'm having issue with the [data] parameter for jquery.post</p>
  
  <p>Here's my code : </p>
  
  <pre><code>$('form').submit(function(){
      var a = $(this).parent().find("input").attr('name');
      var b = $(this).parent().find("input").val();
      var url = $(this).attr('action')
      $.post(url, { a:b },function(data) {
          $(data).find('string').each(function(){
              $('.result').html($(this).text());
          });
      });
      return false;
  });     
  </code></pre>
  
  <p>The problem lies within <code>{a:b}</code>.
  <code>b</code> is interpreted as my <code>var b</code>, but <code>a</code> isn't, making my post parameters something like <code>[a:1]</code> instead of <code>[param:1]</code>.</p>
  
  <p>Is there a way to have a dynamic <code>a</code>?</p>