title: Parameter from button to modal and then call Spring controller
body: <p>I'm enough new with html/javascript so I would need an advice. I have to call modal from button and in this modal I would like to see a table obtained from database.
  So my idea is to call modal through button so:</p>
  
  <pre><code>&lt;tbody&gt;
  &lt;tr th:each="fleet : ${fleets}"&gt;
      &lt;td th:text="${fleet.application}"&gt;&lt;/td&gt;
      &lt;td th:text="${fleet.cubic}"&gt;&lt;/td&gt;
      &lt;td th:text="${fleet.power}"&gt;&lt;/td&gt;
      &lt;td th:text="${fleet.euroClass}"&gt;&lt;/td&gt;
      &lt;td th:text="${fleet.engineType}"&gt;&lt;/td&gt;
      &lt;td th:text="${fleet.traction}"&gt;&lt;/td&gt;
      &lt;td th:text="${fleet.transmission}"&gt;&lt;/td&gt;
      &lt;td&gt;&lt;button data-id="showCarsButton" type="button"
              class="btn btn-primary" data-toggle="modal"
              data-target="#modalShowCar"&gt;Show cars&lt;/button&gt;&lt;/td&gt;
      &lt;td&gt;&lt;button id="addCarButton" type="button"
              class="btn btn-primary"&gt;Add car&lt;/button&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>temporary modal:</p>
  
  <pre><code>&lt;div class="modal fade" id="modalShowCar" role="dialog"&gt;
  &lt;div class="modal-dialog"&gt;
  
      &lt;!-- Modal content--&gt;
      &lt;div class="modal-content"&gt;
          &lt;div class="modal-header"&gt;
              &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
              &lt;h4 class="modal-title"&gt;Fleet cars&lt;/h4&gt;
          &lt;/div&gt;
          &lt;div class="modal-body"&gt;
              &lt;p&gt;Some text in the modal.&lt;/p&gt;
          &lt;/div&gt;
          &lt;div class="modal-footer"&gt;
              &lt;button type="button" class="btn btn-default"
                  data-dismiss="modal"&gt;Close&lt;/button&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>temporary js:</p>
  
  <pre><code>$(document).ready(function(){
      $('#modalShowCar').on('show.bs.modal', function (e) {
          var idFleet = $(e.relatedTarget).data('id');
          $.ajax({
              type : "GET",
              url : "cars/"+ idFleet,
              contentType : 'application/json',
              success : function(data) {
                  if (data.status==200){
                      //I have to pass to modal the data.body
                  } else {
                      //show error
                  }
              },
              error : function(data) {
                  window.location.href = "/500"; //Redirect to page 500
              }
          });
       });
  });
  </code></pre>
  
  <p>and then from modal call the Spring controller with data-url into table tag.
  I need to pass parameter (id) to perform the query, so from the button to the url into modal, how can I do it? Is this the best way?
  thanks,regards</p>