I am trying to make an Ajax request and I miss the 403 forbidden error so the state investigating is an access problem. This is my code.
function EnviarInformacion(accion,objEvento){
$fecha = $('txtFecha').val();
$titulo = $('#txtTitulo').val();
$hora = $('#txtHora').val();
$color =$('#txtColor').val();
$.ajax({
type:"POST",
url:'<?php echo Router::url(array('controller' =>'CalendarioPlantillas', 'action' => 'agregar')); ?>',
dataType: "json",
data:{
fecha:$fecha,
titulo:$titulo,
hora:$hora,
color:$color
},
succes(msg){
calendar.rerenderEvents()
$("#ModalEventos").modal('toggle');
$.notify('<?= __("Evento almacenado correctamente") ?>','success');
},
error:function(xhr, textStatus, errorMessage){
alert("ERROR" + errorMessage + textStatus + xhr);
}
});
}
And to allow the use of my action add I added the following code.
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
$this->Auth->allow(['agregar','delete']);
}