title: how to post select option value into jQuery ajax with name
body: <p>I want to send section option value with ajax but only selection
  and checkbox
  the problem is that section and checkbox post undifined
  thanx advanced</p>
  
  <p><strong>php code</strong></p>
  
  <pre><code>&lt;?php
  
      $paramateres = new ParametresApp();
      $paramateres-&gt;getparametres();
      $max_pages_nbr = $paramateres-&gt;max_pages_nbr;
      $idle_deconnexion = $paramateres-&gt;idle_deconnexion;
      $show_chat = $paramateres-&gt;show_chat;
  
  ?&gt;
  </code></pre>
  
  <p><strong>html code</strong></p>
  
  
  
  <pre><code>    &lt;form id="formparametres" class="form-row row shadow bg-white border row p-5 "
                method="post"&gt;
  
            &lt;div class="form-check col-3 col-lg-3 "&gt;
  
                  &lt;input name="show_chat" id="show_chat" type="checkbox"
                         class="form-check-input" value="&lt;?php echo $show_chat; ?&gt;"
                      &lt;?php if ($show_chat == 1) {
                          echo 'checked="true" ';
                      }
                      ?&gt;
  
                  &lt;label class="form-check-label"
                           for="show_chat"&gt; Autoriser messenger &lt;/label&gt;
                  &lt;/div&gt;
          &lt;div class="col-3 col-lg-3"&gt;
                            &lt;label class="form-control-label"&gt;idle deconexion&lt;/label&gt;
                            &lt;input name="idle_deconnexion" class="form-control"
                                   value="&lt;?php echo $idle_deconnexion; ?&gt;" required&gt;
                      &lt;/div&gt;
  
           &lt;div class="input-wrapper col-4 col-lg-4"&gt;
                      &lt;label class="form-control-label"&gt;max_pages_nbr&lt;/label&gt;
                      &lt;select name="max_pages_nbr" class="form-control" required&gt;
                        &lt;?php  echo '&lt;option value="'.$max_pages_nbr.'"&gt;'.$max_pages_nbr.'&lt;/option&gt;
                            &lt;option value="5"&gt;5&lt;/option&gt;
                            &lt;option value="10"&gt;10&lt;/option&gt;
                            &lt;option value="15"&gt;15&lt;/option&gt;
                            &lt;option value="20"&gt;20&lt;/option&gt;
                            &lt;option value="25"&gt;25&lt;/option&gt;';?&gt;
                      &lt;/select&gt;
                &lt;/div&gt;
          &lt;/form&gt;
  </code></pre>
  
  
  
  <p><strong>jquery code</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>      $("form").submit(function (event) {
                      event.preventDefault();
                      var formData =
                       'show_chat=' + $('input[name=show_chat]').val() +                    
                          '&amp;idle_deconnexion=' + $('input[name=idle_deconnexion]').val() +
  
                          '&amp;max_pages_nbr=' + $('section[name=max_pages_nbr]').val() ;
                      $.ajax({
                          url: "src/admins/inc/save_parametres.inc.php",
                          method: "POST",
                          data: formData, // serializes the form's elements.
                          cache: false,
                          success: function (data) {
                              alert(data);
                          }
  
                      });
  </code></pre>