Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery $.get returns Internal Server Error
    primarykey
    data
    text
    <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>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload