0

Does anyone know how to disable the debug toolbar for Ajax calls?

I have tried this:

$this->container->get('profiler')->disable();

but didn't work.

I have a controller that returns a string (json encoded data). And in the development environment I get

<div class="debug"></div>

at the end of string which breaks my code.

Any help is appreciated.

2 Answers 2

1

If you return a json string anyway just use JsonResponse in your controller.

use Symfony\Component\HttpFoundation\JsonResponse;

$response = new JsonResponse();
$response->setData(array(
    'data' => 123
));

This should do the trick.

Sign up to request clarification or add additional context in comments.

3 Comments

thanks, I also figured that while crawling Symfony's source but I still get an extra "<div class="debug"></div>" after the response. That only happens in dev environment (using app_dev.php) I am trying to find where that extra string comes from.
Then it probably comes from your code, symfony doesn't add this kind of code.
exactly :) a legacy code was left within our library. thanks for your help!
0

found a leftover function from a legacy debug alternative that we have written to symfony's own debug toolbar in one of our listeners. so there was no symfony issue but a developer error.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.