I am working on a symfony application, and I am trying to delete a remember me cookie, using the following code:
$response->headers->clearCookie($cookieName,'/');
I have to call the response->send()
method for this to take effect, this works perfectly with a simple response, but when i try to use it with a jsonResponse, the function send()
returns this error:
JSON.parse: unexpected non-whitespace character after JSON data
There is nothing wrong with my json data, even if i specify no data it seems that send function is just not working with a jsonResponse
Here is my code for the jsonResponse :
$array = array('message'=>'your account is disabled','success'=>false);
$response = new JsonResponse($array);
$response->send(); //this triggers the error
Your help will be appreciated !