Jump to content

Fatal error when sending AJAX requests (in developer mode only)


Recommended Posts

Hi PrestaShop community!

 

I'm sending AJAX requests successfully (using this tutorial as a base: http://www.amauri.eng.br/en/blog/2016/03/prestashop-sending-ajax-requests-to-admin-controllers/)

 

Everything is working fine if the developer mode is off (define('_PS_MODE_DEV_', false);) but when I activate it, I receive the following fatal error:

Fatal error: Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message 'Warning: Cannot modify header information - headers already sent by (output started at /Users/admin/Documents/sites/ps/modules/test/public/ajax/modalImport.php:14)' in /Users/admin/Documents/sites/ps/classes/controller/AdminController.php:1819 Stack trace: #0 [internal function]: Symfony\Component\Debug\ErrorHandler->handleError(2, 'Cannot modify h...', '/Users/admin...', 1819, Array) #1 /Users/admin/Documents/sites/ps/classes/controller/AdminController.php(1819): header('Cache-Control: ...') #2 /Users/admin/Documents/sites/ps/classes/controller/Controller.php(197): AdminControllerCore->initHeader() #3 /Users/admin/Documents/sites/ps/classes/Dispatcher.php(366): ControllerCore->run() #4 /Users/admin/Documents/sites/ps/admin570ews5ay/ajax-tab.php(53): DispatcherCore->dispatch() #5 {main} thrown in /Users/admin/Documents/sites/ps/classes/controller/AdminController.php on line 1819

Still everything is working (I send the request and receive the response successfully) but I'm just curious why I am receiving this in developer mode?

I'm using the latest PrestaShop (1.7.0.1). Am I doing something wrong?

 

Thanks in advance!!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...