0
I have the following situation:
Form
<?php
$atributos = array('id'=>'cadloja','class'=>'form-inline','role'=>'form','data-toggle'=>'validator');
echo form_open('',$atributos);
?>
<select class="form-control" id="grupo">
<option value="<?= 'retorno_ajax' ?>"><?= 'retorno_ajax' ?></option>
</select>
<?php
echo form_close();
?>
Javascript
$('#grupo').change(function () {
$('#div_retorno').load('lista_grupos');
}
Note that I am not using ajax requests or submitting the form in the event onchange
. With the csrf
active, the onchange
doesn’t work anymore.
I even found some answers on SOen
, but at all, would be forced to make another ajax request at the event onchange
. I read in the documentation of CI
also that it is possible to exclude a page from the verification csrf
:
$config['csrf_exclude_uris'] = array('controllerx/metodox');
That option is the least laborious, but would be safe yet?
So, is this... is there any way to do it differently than the two I was talking about? Thank you.
Of course you’re using requisitions. load() is a request. And as the csrf is interfering, it’s being done via _$POST. Show the whole code.
– ShutUpMagda