title: Sending an array in POST body
body: <p>Im trying to send an array to my Node/MongoDB server via and AJAX POST request. The body also contains other variables. Here is the client side JS code: </p>
  
  <pre><code>function setupForm(){
      $("#add").submit(function(event) {
          event.preventDefault();
          var name = $("#name").val();
          var logo = $("#logo").val();
          var phone = $("#phone").val();
          var email = $("#email").val();
          var address = $("#address").val();
          var postcode = $("#postcode").val();
          var openingHours = $("#openingHours").val();
          var loc = [44, 44];
  
          $.ajax({
              type: "POST",
              url: "http://localhost:3000/services",
              data: "name=" + name + "&amp;logo=" + logo + "&amp;phone=" + phone + "&amp;email=" + email + "&amp;address=" + address + "&amp;postcode="+ postcode +"&amp;openingHours=" + openingHours + "&amp;loc=" + loc,
              success: function(){alert('success');}
          });
      });
  }
  </code></pre>
  
  <p>And here is the the server side code:</p>
  
  <pre><code>exports.addWine = function(req, res) {
      var wine = req.body;
      console.log('Adding wine: ' + JSON.stringify(wine));
      db.collection('services', function(err, collection) {
          collection.insert(wine, {safe:true}, function(err, result) {
              if (err) {
                  res.send({'error':'An error has occurred'});
              } else {
                  console.log('Success: ' + JSON.stringify(result[0]));
                  res.send(result[0]);
              }
          });
      });
  }
  </code></pre>
  
  <p>It adds it to the database but in this format. I would like it in an array:</p>
  
  <pre><code>"postcode" : "ugh",
  "openingHours" : "fhgfh",
  "loc" : "44,44"
  </code></pre>