XF 2.2 Am I making this ajax request correct?

dsick

Member
this is the ajax

JavaScript:
    XF.ajax('GET', XF.canonicalizeUrl('statistics'), ajaxData, function (data) {

        });

here is how I'm accessing in controller, selectedOption is in the ajaxData

PHP:
public function actionIndex(ParameterBag $params) {

 

$selectedOption = $this->filter('selectedOption', 'int');

$viewParams = [

'selectedOption': $selectedOption

];

        return $this->view('mycontroller/action', 'my_template', $viewParams);



}

I'm using {$selectedOption} to access in the template but it keeps returning 0 I put $selectedOption in var_dump and logerrors function and it returned what was expected but it seems I don't have access to $selectedOption in viewParams.
 
Back
Top Bottom