RSS Feed/News [SOLVED] setResponseType() json data not coming through controller reply

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
24,710
Points
823

Reputation:

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...
 
Status
Not open for further replies.
Top