Is there a way to prevent echo json_encode() return the JSON response with the whole page when submitting form to the same PHP script?
I've got this only index.php file in the project. I know I should separate the logic from the view, use different files for PHP, JS and HTML. This is only a test: <?php if($_SERVER["REQUEST_METHOD"] == "POST") { if(isset($_POST["item"]) && $_POST["item"]…