title: WordPress frontend AJAX Form submission gives 500 internal server error
body: <p>I am creating a custom wordpress plugin that it has a frontend form, and i want the data to be sent to the database with AJAX and also return a response to update the frontend table.</p>
  
  <p>Everything looks good, till i click "submit" button</p>
  
  <p>So my AJAX is :</p>
  
  <pre><code>$('#form').submit(function(event) {
  
      var formData = {
          'user'              : $('input[name=userid]').val(),
          'cardname'             : $('input[name=card]').val(),
          'setname'             : $('input[name=setname]').val(),
          'quantity'    : $('input[name=quantity]').val(),
          'multiverseid'    : $('input[name=multiverseid]').val()
      };
  
      // process the form
      $.ajax({
          type        : 'POST', // define the type of HTTP verb we want to use (POST for our form)
          url         : ''+base_url+'/website/wp-content/plugins/test/public/js/process.php', // the url where we want to POST
          data        : formData, // our data object
          dataType    : 'html', // what type of data do we expect back from the server
          encode          : true,
          success : function(updatedTable) {
              $('div#tableHolder').html(updatedTable);
          }
      })
  
         });
  
   // stop the form from submitting the normal way and refreshing the page
      event.preventDefault();
  
     });
  });
  </code></pre>
  
  <p>The process.php file that will add the data is :</p>
  
  <pre><code>global $wpdb;
  
  $wpdb-&gt;insert( 
  'wp_mycards', 
  array( 
      'user' =&gt; $_POST[userid], 
      'cardname' =&gt; $_POST[cardname],
       'setname' =&gt; $_POST[setname],
       'quantity' =&gt; $_POST[quantity],
       'multiverseid' =&gt; $_POST[multiverseid] 
  
       )
   );
  
  
  
  $data="&lt;table&gt;&lt;tr&gt;&lt;td&gt;Image&lt;/td&gt;&lt;td&gt;Name&lt;/td&gt;&lt;td&gt;Set&lt;/td&gt;&lt;td&gt;Quantity&lt;/td&gt;&lt;/tr&gt;";
  
  $user_ID = get_current_user_id();
  $cards = $wpdb-&gt;get_row( "SELECT * FROM $wpdb-&gt;wp_mycards WHERE user = ".$user_ID."" );
  
  while ($row = mysql_fetch_assoc($cards)) { 
  
      $data.='&lt;tr&gt;&lt;td align="center"&gt;&lt;img src="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid='.$row[multiverseid].'&amp;type=card" width="30" height="42" /&gt;&lt;/td&gt;&lt;td align="left"&gt;'.$row[cardname].'&lt;/td&gt;&lt;td align="center"&gt;'.$row[setname].'&lt;/td&gt;&lt;td align="center"&gt;'.$row[quantity].'&lt;/td&gt;&lt;/tr&gt;';
  
    }
  
   $data.="&lt;/table&gt;";
  
   echo $data;
  </code></pre>
  
  <p>-I run it at firefox and at firebug it gives me 500 internal server error-The post values are fine</p>