[SOLVED] setResponseType() json data not coming through controller reply

Status
This content is read-only, or is not open for further replies.

asprin

Guest
offline
I've an onchange event handler defined which makes an AJAX call
JavaScript:

Code:
// url points to myController/my-method
XF.ajax('GET', url, {'tid':2, 'eid':1}, function (data){
    console.log(data);
});

This is the controller method
PHP:

Code:
public function actionMyMethod()
{
    $this->setResponseType('json');

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

    $viewParams = [
        't'  => $tid,
        'e' => $eid
    ];

    return $this->view('AFC:myFunction', ''...

Read more

Continue reading...
 
Liked by:
Status
This content is read-only, or is not open for further replies.
Top Bottom