title: Send multiple select form as an array with jquery
body: <p>Currently I'm posting single values from some multiple select boxes. If I want to post the variables as arrays on the field activity and yearOfBirth instead of strings, how can I achieve this by changing my current code?</p>
  
  <p>Thanks!</p>
  
  <pre><code>function showUser() {
      // getting the value that user typed
      var firstName = $("#firstName").val();
      var lastName = $("#lastName").val();
      var sex = $("#sex").val();
      var registrationType = $("#registrationType").val();
      var activity = $("#activity").val();
      var yearOfBirth = $("#yearOfBirth").val();
  
      // forming the queryString
      var data = 'search_firstName=' + firstName + '&amp;search_lastName=' + lastName + '&amp;search_registrationType=' + registrationType + '&amp;search_activity=' + activity + '&amp;search_yearOfBirth=' + yearOfBirth + '&amp;search_sex=' + sex;
  
      // if searchString is not empty
      if (firstName || lastName || sex || registrationType || activity || yearOfBirth) {
          // ajax call
          $.ajax({
              type: "POST",
              url: "groupQsearchMember.php",
              data: data,
              beforeSend: function() {
                  $('#whileLoading').show();
                  $('#results').hide();
              },
              complete: function() {
                  $('#whileLoading').hide();
              },
              success: function(html) {
                  $("#results").html(html);
                  $("#results").fadeIn(700);
              },
  
          });
      }
      return false;
  };​
  </code></pre>