title: Wordpress ajax call in an admin menu page
body: <p>I'm trying to use the data of an ajax call in my custom wordpress admin menu page.</p>
  <p>The <code>wp_localize_script</code> is working fine:</p>
  <pre><code>wp_enqueue_script( 'ajax-function', plugin_dir_url( __FILE__ ) . 'JavaScript/ajax-function.js', array( 'jquery' ), $this-&gt;version,false );
  wp_localize_script('ajax-function', 'WP_MY_AJAX',
       array(
         'security' =&gt; wp_create_nonce('wp-my-nonce'),
         'success' =&gt; 'this is a success',
         'error' =&gt; 'an error occurred'
       )
  );
  </code></pre>
  <p>If I click the button, my ajax fires and it has a status of 200.</p>
  <pre><code>jQuery(document).ready(function() {
      let message = jQuery('.table-message');
      jQuery('#ajax-test').on('click', function () {
          let data = 111;
  
          jQuery.ajax({
              url: ajaxurl,
              type: 'POST',
              dataType: 'json',
              data: {
                  action: 'get_edit_id',
                  security: WP_MY_AJAX.security,
                  edit_id: data
              },
              success: function ( response ) {
                  //Do something
              },
              error: function ( error ) {
                  jQuery('.error').remove();
                  message.after('&lt;div class=&quot;error&quot;&gt;&lt;p&gt;' + WP_ESCORT_AJAX.error + '&lt;/p&gt;&lt;/div&gt;');
              }
          });
      });
  </code></pre>
  <p>I end up in this function, which is located in my main plugin file.</p>
  <pre><code>function my_escort_get_edit_id() {
      check_ajax_referer('wp-escort-nonce', 'security');
  
     echo $_POST['edit_id']
     die();
  }
  add_action('wp_ajax_get_edit_id', 'my_escort_get_edit_id');
  add_action('wp_ajax_nopriv_get_edit_id', 'my_escort_get_edit_id');
  </code></pre>
  <p>However my goal is to work with the <code>$_POST['edit_id']</code> in my admin menu page function:</p>
  <pre><code>function my_custom_admin_menu() {
      add_menu_page(
          __( 'My Menu', 'my-menu' ),
          __( 'My Menu', 'my-menu' ),
          'edit_posts',
          'my-menu-slug',
          'my_admin_page_function',
          'dashicons-universal-access',
          3 ) ;
  }
  add_action( 'admin_menu', 'my_custom_admin_menu' );
  
  function my_admin_page_function() {
      require_once __DIR__ . '/View/Admin/Partials/cover-menu-models.php';
      requireModel('all');
  
      $controller = new ModelController();
  
      $modelQuery = $controller-&gt;modelQuery('all');
      echo $controller-&gt;renderModelDataTables($modelQuery, 'all');
      
      //I need the id here
  
  }
  </code></pre>
  <p>How can I achive this?</p>