What is the best way to return a json string or a simple text on screen in nette php framework without loading the template?
You can use method sendJson($data)
in your presenter.
function renderDefault()
{
$data = ['hello' => 'world'];
$this->sendJson($data);
}
Will output {"hello":"world"}
with application/json
Content-Type