Uncaught SyntaxError: Unexpected token < in JSON at position 0
I need to return json, send it throw $.get request and show it with .html funtion. I would prefer dom option, but i have a laravel framework on backend, and i'm still using blade. So i have something like:
$response = [
'success' => true,
'content' => view('/collette/create_step_01', compact('prodotto', 'destinatario', 'input'))->render(),
];
and i return
return json_encode($response);
There is a better way for return json on laravel?
On js i have
var qs = getQueryString();
if (typeof(step) === 'undefined') {
initColletta(); //define step
}
$.get(url + 'collette/create/steps/' + step, qs, function(data) {
var res = JSON.parse(data);
if (res.success) {
showModalBody(res.content);
if (typeof(res.stop) !== 'undefined' && res.stop) {
$('#step-next').attr('href', res.link).unbind('click');
}
}
});