title: How to send a radio button value via AJAX?
body: <p>I've created a "global" ajax-modal-function that sends ajax-requests with values stored in <code>data-array</code> at the parent <code>#modal-content</code>. </p>
  
  <p>That's how a HTML field looks like (as an example):</p>
  
  <pre><code>&lt;input data-array='data[]' name='gender' type='radio' value='1' /&gt; 
  &lt;input data-array="data[]" type="password" name="password" /&gt;
  </code></pre>
  
  <p>That's how I store the data before I use tha $.ajax JQuery function to get all the data of every input field of the current modal:</p>
  
  <pre><code>var data_array = $('#modal-content').find('*[data-array]').map(function(idx, elem) {    
      return elem.value.trim(); 
  }).get();
  </code></pre>
  
  <p>Then the $.ajax function looks like this:</p>
  
  <pre><code>$.ajax({
      type: "POST", url: "ajax_modal.php", dataType: "json",
      data: { 
          data: data_array, 
          data_case: data_case, 
          id: id, 
          uid: uid, 
          dataString: 'modal_save' 
      },
      success: function(data) {
  </code></pre>
  
  <p>So the array is stored in <code>data_array</code> and it works fine. </p>
  
  <p>But now I have this radio input field or a checkbox. How can I get the value in my array to store its value depending on if the user clicked it or not? </p>