It works fine it returns me an json object after all if I write like this.
public function getElementsAction()
{
$currency = App::$app->getProperty('currency');
if(!empty($_POST))
{
$sql = 'SELECT name, price, file, time FROM listings WHERE id_item IN (' . implode(',', $_POST) . ')';
$items = \R::getAll($sql);
echo(json_encode($items));
}
}
But what I want is get a string of var_dump and print out in console.log for further debuggin, what do I do then? I tried both ways and it gives me error in console.log :((
public function getElementsAction()
{
$currency = App::$app->getProperty('currency');
if(!empty($_POST))
{
$sql = 'SELECT name, price, file, time FROM listings WHERE id_item IN (' . implode(',', $_POST) . ')';
$items = \R::getAll($sql);
//echo(json_encode(var_dump($items))); // error
//echo(json_encode(strval(var_dump($items)))); // error
//echo(json_encode("Hi"); // No error
}
}
or is it something I can see in Network somewhere? thank you!