title: Ajax POST Data for certain field id
body: <p>I am trying to send some data to an ajax script, usually I create a form tag and give the form an id like this:</p>
  
  <pre><code>&lt;form id="myForm"&gt;
  </code></pre>
  
  <p>And then I just add the following in the ajax:</p>
  
  <pre><code>data: $('#myForm').serialize(),
  </code></pre>
  
  <p>This sends all the form data from my form. However, this time I am trying to run it without the form tag and instead i have two fields with unique id's like this:</p>
  
  <pre><code>&lt;input type="text" id="first-name" name="first-name"&gt;
  &lt;input type="text" id="last-name" name="last-name"&gt;
  </code></pre>
  
  <p>I want to send the data from these two fields only. So i've put the following code in:</p>
  
  <pre><code>data: $("#first-name,#last-name"),
  </code></pre>
  
  <p>It does seem to work, but wondering if this is the correct and compatible way to do this.</p>
  
  <p>Thanks</p>