title: How to pass the variable value from jQuery to java code in html
body: <p>I need to change my query to database depending on choosen radio button. I'm using MVC play framework, java, jQuery and HTML.</p>
  <p>Here is the form with radio buttons and select with options, where options are requested in RequestController.java controller.</p>
  <pre><code>   &lt;div class=&quot;form-group row formbuilder-radio-group form-group field-radio-group-1650256975381&quot;&gt;
              &lt;label for=&quot;radio-group-1650256975381&quot; class=&quot;col-sm-2 formbuilder-radio-group-label&quot;&gt;Select&lt;span class=&quot;formbuilder-required&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
              &lt;div class=&quot;col-sm-10&quot;&gt;
                  &lt;div class=&quot; radio-group&quot;&gt;
                      &lt;div class=&quot;form-check form-check-inline formbuilder-radio&quot;&gt;
                          &lt;input class=&quot;form-check-input&quot;  name=&quot;radio-gov&quot;  access=&quot;false&quot; id=&quot;radio-group-1650256975381-0&quot; required=&quot;required&quot; aria-required=&quot;true&quot; value=&quot;65&quot; type=&quot;radio&quot;&gt;
                          &lt;label class=&quot;form-check-label&quot; for=&quot;radio-group-1650256975381-0&quot;&gt;NIO&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;form-check form-check-inline formbuilder-radio&quot;&gt;
                          &lt;input class=&quot;form-check-input&quot;  name=&quot;radio-gov&quot;  access=&quot;false&quot; id=&quot;radio-group-1650256975381-1&quot; required=&quot;required&quot; aria-required=&quot;true&quot; value=&quot;66&quot; type=&quot;radio&quot;&gt;
                          &lt;label  class=&quot;form-check-label&quot; for=&quot;radio-group-1650256975381-1&quot;&gt;TSM&lt;/label&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div style=&quot;margin-top: 10px;&quot;&gt;
                      &lt;select class=&quot;form-control&quot; name=&quot;select-1650256981364&quot; id=&quot;select-gov&quot; required&gt;
                          #{list items:onlyParentGovAgencyList, as:'govAgency'}
                          #{if govAgency.parent != null}
                              #{if govAgency.parent.id == $tov} &lt;!-- can't pass the $tov --&gt;
                              &lt;option value=&quot;${govAgency.id}&quot;&gt;
  
                                  ${govAgency.name}
                              &lt;/option&gt;
                              #{/if}
                          #{/if}
                      #{/list}
  
                      &lt;/select&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  <p>here's the jQuery that get's the value for $tov</p>
  <pre><code> &lt;script type=&quot;text/javascript&quot;&gt;
      $(document).ready(function () {
          $('input[type=radio]').click(function () {
              if (this.name==&quot;radio-gov&quot;)
                  var $tov=$('input[name=radio-gov]:checked','#myForm').val();
  
              console.log($tov);
          });
      });
  &lt;/script&gt;
  </code></pre>
  <p>How can I pass the $tov to my #list?</p>