for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: simon
* Date: 04-Jan-17
* Time: 21:28
*/
class AjaxController extends Controller
{
private static $allowed_actions = array(
'index'
);
public function index(SS_HTTPRequest $request)
$sortMethod = $request->postVar('type') . 'PopularAddons';
$addons = HomeController::$sortMethod(5);
$body = $this->renderWith('PopularAddons', array('PopularAddons' => $addons));
$response = new SS_HTTPResponse();
$response->addHeader('Content-Type', 'application/json');
$response->setBody(Convert::array2json(array('success' => true, 'body' => $body->getValue())));
return $response;
}