title: Get true or false for radio button in Javascript
body: <p>I am getting data from my view, and using JavaScript to save.</p>
  
  <p>HTML:</p>
  
  <pre><code> &lt;div&gt;
       @Html.LabelFor(model =&gt; parts.ReturnRequired)
       @Html.RadioButtonFor(model =&gt; parts.ReturnRequired, true) Yes
       @Html.RadioButtonFor(model =&gt; parts.ReturnRequired, false) No
   &lt;/div&gt;
  </code></pre>
  
  <p>This is my JavaScript:</p>
  
  <pre><code>$(document).ready(function () {
      $('#btPartHeaderSave').click(function () {
          var status = $('#parts_Status').val();
          var partsRequestOrderNum = $('#parts_PartsRequestOrderNum').val();
          var custShipping = $('#parts.CustShipping').val();
          var shipAddress1 = $('#parts_ShipAddress1').val();
          var shipAddress2 = $('#parts_ShipAddress2').val();
          var shipCounty = $('#parts_ShipCounty').val();
          var postCode = $('#parts_ShipPostCode').val();
          var deliveryType = $('#parts_DeliveryType').val();
          var notes = $('#parts_Notes').val();
          //var returnRequired = $('#ReturnRequired').val() == true;
  
          $.ajax({
              url: $(this).attr('data-url'),
              //url: "/Parts/PartHeaderSave",
              type: "POST",
              data: JSON.stringify({
                  status: status, 
                  partsRequestOrderNum: partsRequestOrderNum, 
                  custShipping: custShipping, 
                  shipAddress1: shipAddress1, 
                  shipAddress2: shipAddress2, 
                  shipCounty: shipCounty, 
                  postCode: postCode, 
                  deliveryType: deliveryType, 
                  notes: notes, 
                  returnRequired: returnRequired
              }),
              dataType: "json",
              traditional: true,
              contentType: "application/json; charset=utf-8",
              success: function (data) {
                  alert("You have sucessfully saved the header");
                  alert(returnRequired);
                  //   $('#alertSavePartOrderHeader1').addClass('in');
              },
              error: function () {
                  alert("An error has occured!!!");
              }
          });
      });
  });
  </code></pre>
  
  <p>I am trying to get the value of <code>ReturnRequired</code>.</p>
  
  <pre><code>//var returnRequired = $('#ReturnRequired').val();
  </code></pre>
  
  <p>How do I set this up, to show in the database as <code>1</code> or <code>0</code>?
  I am assuming using, <code>.val()</code> won't work.</p>
  
  <p>For some reason, if I click yes it returns <code>0</code>, and if I click no, it still returns <code>0</code>, even though in my html I got my <code>true</code> / <code>false</code>.</p>