title: jQuery input with same name and square brackets
body: <p>I have a form that is using jQuery and Ajax to post the form data, but cannot get it to send the values of inputs with the same name and square brackets.</p>
  
  <p>The inputs look like this and will have different values:</p>
  
  <pre><code>&lt;input type="text" name="service[]" value="Value 1"&gt;
  </code></pre>
  
  <p>Here is the var for getting the value:</p>
  
  <pre><code>var service = $("input[name=service\\[\\]]")
  </code></pre>
  
  <p>Then the var for collecting the data to send via Ajax looks like this: </p>
  
  <pre><code>var data = 'name=' + name.val() + '&amp;email=' + email.val() + '&amp;phone=' + phone.val() + '&amp;service=' + service.val() + '&amp;brief='  + encodeURIComponent(brief.val());
  </code></pre>
  
  <p>Then in the PHP script for sending the mail includes the following...</p>
  
  <pre><code>$service = $_POST['service'];
  $body .= implode(' | ', $service);
  </code></pre>
  
  <p>So my question is, how do I get the values of the inputs with the name <code>name=service[]</code> and send them via Ajax.</p>
  
  <p>Thanks in advance :)</p>