title: AJAX to update mySQL in Wordpress Custom Table
body: <p>I have followed <a href="https://wordpress.org/plugins/custom-list-table-example/" rel="nofollow noreferrer">Matt Van Andel's Custom List Table Example</a> to create an admin table which displays enquiries to a website via an external MySql database.</p>
  
  <p>Having implemented the displaying of my data correctly, I have added a select box column which will allow the admin to update the 'status' of the enquiry (Awaiting Response, Responded etc.) and I need this to update my database via AJAX.</p>
  
  <p>I need a change in these select boxes to trigger an AJAX call which will update the database with the new value but I seem to be struggling to link my external AJAX file to my plugins .php file correctly.</p>
  
  <p>I have reached a point where (in the Network tab) I can see I am loading the .js file like so:</p>
  
  <p>Code in list-table.php:</p>
  
  <pre><code>function ajax_test_enqueue_scripts() {
          wp_enqueue_script( 'list-table', plugins_url( 'js/list-table.js', __FILE__ ), array('jquery'));
      }
      add_action( 'admin_enqueue_scripts', 'ajax_test_enqueue_scripts' );
  </code></pre>
  
  <p>And my AJAX:</p>
  
  <pre><code>jQuery('.status-select').on( 'change', function ajaxSubmit() {
  
      alert("IT WORKED!");
  
          $.ajax({
          url: ajaxurl,    
          type: "POST",
          cache: false,
          data: this.val()
  
      })
  });
  </code></pre>
  
  <p>At the moment the file is showing but the 'on change' part doesn't seem to be firing (hence the 'alert' in the .js).</p>
  
  <p>Apologies if this question is worded or organised poorly, it is my first time posting!</p>
  
  <p>Hope someone can explain what/ where I am going wrong.</p>