I have a php script that I use GET to get a url parameter and switch to a switch php and run a particular function.
This script works perfectly without any errors but how to use it with ajax ??When I call ajax with url
url : cor.php
, (in this case I would call the php file with switch ) it displays error and does not proceed, it does not find the switch function
Can anyone help me with this?
Switch structure:
<?php
session_start();
if (empty($_SESSION['id_usuario'])){
echo "Acesso negado!";
exit;
}else{
include "conexao.php";
$id = (int)$_GET["id"];
$acao = $_GET['acao'];
switch ($acao) {
case alterar:
break;
case excluir:
break;
case bloquear:
case ativar:
break;
case cadastroCor:
break;
}}
?>