title: How i can fix 400 (Bad Request) ajax error on.change form jquery?
body: <p>Hello guys I have a problem when I'm trying to send data by ajax and it's said that I have 400 (Bad Request) ajax errors and this is my code:</p>
  <p>This is Html code:
  the rows is data of my database
  $row['attributes'] it has (size,brand,color......)</p>
  <pre><code> &lt;form id=&quot;form&quot;&gt;
      &lt;?php foreach($rows as $row): ?&gt;
      &lt;fieldset&gt;
          &lt;?php
            $result_attributes = get_terms([
              'taxonomy' =&gt; $row['attributes'],
              'hide_empty' =&gt; false,
            ]);
          ?&gt;
          &lt;select id=&quot;select-wid&quot; name=&quot;&lt;?php echo $row['attributes']?&gt;&quot;&gt;
            &lt;option value=&quot;&quot;&gt;Select&lt;/option&gt;
              &lt;?php foreach($result_attributes as $result_attribute) : ?&gt;
                  &lt;option value=&quot;&lt;?php echo $result_attribute-&gt;term_id; ?&gt;&quot;&gt;&lt;?php echo $result_attribute-&gt;name; ?&gt;
                  &lt;/option&gt;
              &lt;?php endforeach; ?&gt;
          &lt;/select&gt;
      &lt;/fieldset&gt;
      &lt;?php endforeach;
  </code></pre>
    
  This is jquery code:
  <pre><code>(function($){
                  $(document).ready(function(){
                    $(document).on('change', '#form', function(e) {           
  
                      var data = $(this).serialize();
  
                      e.preventDefault();
  
                      console.log(data);
                      $.ajax({
                        url: my_url,
                        data: data,
                        action: 'myactionfunction',
                        type: 'post',
                        success: function(result) {
                          $('.products').html(result);
                        },
                        error: function(result) {
                          console.warn(result)
                        },
                      });
  
                    });
                  });
  })(jQuery);
  </code></pre>
  <p>Image from console
  <a href="https://i.stack.imgur.com/uH203.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>Image from php
  <a href="https://i.stack.imgur.com/wnBOh.png" rel="nofollow noreferrer">enter image description here</a></p>