Hi,
I use syintax below for AJAX frontend filter in partial: {{ form_ajax('onFilterReports', { update: { 'site/annualReport': '#partialSelectedAnnualReport'} }) }}
On top of partial file I have the following code:
==
<?
use Example\AnnualReports\Models\Report;
function onStart() { $this->prepareVars(); }
function onFilterReports() { $this->prepareVars(); }
function prepareVars()
{
$options = post('Filter', []);
$this['reports'] = Report::listFrontEnd($options);
$reports = Report::all();
$this['years'] = $reports->pluck('year')->all();
}
?>
==
But I have ‘AJAX handler ‘onFilterReports’ was not found.’ error, and I could not find why.
Thank you,
Zs