title: jQuery treat strings as variables?
body: <p>I've done some work with Scriptaculous, and now I'm dipping my feet in to JQuery to see which of the two frameworks I like working with the most. I am running in to some behavior that strikes me as odd...</p>
  
  <pre><code>        $.ajax({
          type: "POST",
          url: "addcart.php",
          data: "userID="+ userID + "&amp;cardID=" + cardID + "&amp;cardQTY=" + cardQTY + "&amp;set=m10",
          success: function(msg){alert("succeed " + msg)},
          error: function(msg){alert("fail " + msg)}
      });
  </code></pre>
  
  <p>I try to keep my variable names as similar as possible from page to page, so I was attempting to pass "variable name = variable value" to my PHP. However, this call kept passing "foo=foo&amp;bar=bar insead of "userID=foo&amp;cardID=bar", which led to quite a bit of confusion until I noticed what was going on.</p>
  
  <p>I suppose my question is, did I somehow trigger some bug, or is this an intentional feature of JQuery? I can see it coming handy when trying to do "$('#variable')" if it's intentional...</p>
  
  <p>Edit to add:</p>
  
  <p>On the recieving end everything seemed to be working fine. Just the variable names were not what I expected since it was passing the variable value=variable value instead of name=value</p>
  
  <p>When I changed the code to the below the function worked as I intended it I assume because the names are not used as variables anywhere:</p>
  
  <pre><code>            $.ajax({
          type: "POST",
          url: "addcart.php",
          data: "UID="+ userID + "&amp;CID=" + cardID + "&amp;QTY=" + cardQTY + "&amp;set=m10",
          success: function(msg){alert("succeed " + msg)},
          error: function(msg){alert("fail " + msg)}
      });
  </code></pre>
  
  <p>I prefer to keep the variable names the same, however, so I presume the answer below will work for me?</p>