title: Script called by AJAX from Wordpress plugin isn't getting $wpdb
body: <p>I'm writing a Wordpress plugin and want to use ajax to submit data. When using ajax to submit a form in the admin panel, I get this error:</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function insert() on a non-object in
    /home1/crave/public_html/wp-content/plugins/MiniCMS/add_contenttype.php
    on line 13</p>
  </blockquote>
  
  <p>Here's the script being called. Error line is annotated.</p>
  
  <pre><code>&lt;?php
  global $wpdb;
  
  $name = $_POST["name"];
  $id = '1';
  $text_inputs = $_POST["text_inputs"];
  $paragraph_inputs = $_POST["paragraph_inputs"];
  $map_inputs = $_POST["map_inputs"];
  $file_inputs = $_POST["file_inputs"];
  
  $contentTypeTable = $wpdb-&gt;prefix . "minicms_content_type";
  
  //This is line 13, the problem child:
  $wpdb-&gt;insert( $contentTypeTable, array(
      'name' =&gt; $name,
      'id' =&gt; $id,
      'text_inputs' =&gt; $text_inputs,
      'paragraph_inputs' =&gt; $paragraph_inputs,
      'map_inputs' =&gt; $map_inputs,
      'file_inputs' =&gt; $file_inputs
  ));
  ?&gt;
  </code></pre>
  
  <p><strong>Does anyone know why I'm not getting $wpdb to work?</strong></p>