Jquery $.get returns Internal Server Error
<p>I'm trying to built a CRUD application with PHP and jQuery and i'm facing some problems. My main file is index.php, where i include another file called config.php and i define a switch statement. In turn, config.php includes other files and in the end of it i have some css and js includes.</p>

<p>This is index.php</p>

<pre><code>&lt;?php

require_once('config.php');

switch($_GET['action'])
{
  case "add": addRow(); break;

  case "delete": deleteRow();break;

  default: listRows();break;
}

?&gt;
</code></pre>

<p>This is Config.php</p>

<pre><code>&lt;?php

require_once('includes/Table.php');

require_once('includes/Language.php');

?&gt;

&lt;link type="text/css" rel="stylesheet" href="css/sorter/style.css"/&gt;

&lt;script src="js/jquery.tablesorter.js"&gt;&lt;/script&gt;

&lt;script src="js/jquery.tablesorter.pager.js"&gt;&lt;/script&gt;
</code></pre>

<p>The files are included correctly because everything so far works fine. The listRows() function is executed by default and lists a table, where in every row i have edit and delete buttons. The tricky part is that when i click on the delete button in a row, i call again the index.php file useing jQuery $.get method, passing in the url the parameter action=delete. This method returns an Internal Server Error and i believe that the problem resides in the require statements, because when i tried the following it worked.</p>

<pre><code>&lt;?php

switch($_GET['action'])
{
  case "add": addRow(); break;

  case "delete": echo 1; break;

  default: require_once('config.php'); listRows();break;
}

?&gt;
</code></pre>

<p>The problem is that I want to use the included files in the delete case as well. Is there any solution?</p>

<p>Thanks a lot.</p>
