title: Passing jQuery variable to functions.php Wordpress
body: <p>I'm sending the <strong>x</strong> jQuery variable to php file.</p>
  
  <p>This is my jQuery with the ajax:</p>
  
  <pre><code>  jQuery(document).ready(function($) {
  
  var x = jQuery('#sbering option:selected').val();
  jQuery('#optionvalue').html(x);
  
    jQuery.ajax({
          url: frontEndAjax.ajaxurl,
          data: {
              'action':'my_ajax_function',
              'id' : x
          },
          success:function(data) {
            console.log(data);
          },
      });
  });
  </code></pre>
  
  <p>This is the function where I'm sending the x variable:</p>
  
  <pre><code>function my_ajax_function() {
  
    if(isset($_REQUEST['id'])) {
      $aux = $_REQUEST['id'];
      echo "ID: " . $aux;
    }
    var_dump($aux);
  ...
  </code></pre>
  
  <p>instead of printing both $aux and var_dump($aux) on screen 
  they're only visible in the console and $aux in php is Null.</p>
  
  <p><a href="https://i.stack.imgur.com/cpS5a.png" rel="nofollow noreferrer">Image1</a>
  <a href="https://i.stack.imgur.com/KySUW.png" rel="nofollow noreferrer">Image2</a></p>
  
  <p>What am I doing wrong?</p>