I'm doing a project in Symfony and when I send the data by ajax the answer I generate with json_encode()
gives me error
This is my ajax code
$.ajax ({
data: {"id": id_category, "type": "add_row_interno"},
type: "POST",
dataType: "json",
url: "{{ path('acme_smart_action') }}",
success: function (rescue_data,status) {
alert(JSON.stringify(rescue_data));
},
error:function (rescue_data) {
alert(JSON.stringify(rescue_data));
}
});
answer function
public function showRowProducts($id_service)
{
$result["result"] = "result";
return new Response(json_encode($result));
}
and I get the following in error
{"readyState":4,"responseText":"{\"result\":\"result\"}","status":200,"statusText":"OK"}