We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Problems trying to AJAXify a module

Development and Programming

Gwarrior's avatar
Gwarrior
40 posts
16 years ago
Gwarrior's avatar Gwarrior

I have a module that basically creates a contact form, and it works just fine. However, when I try to AJAX it (I’ve been doing AJAX for a year now, I’m quite sufficient) by submitting the data to the mod.contactmanager.php file of the module to the function accept_contact(), it brings up the following error:

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at …/domains/ideasandpixels.com/html/system/expressionengine/third_party/contactmanager/mod.contactmanager.php:134)

Filename: core/Common.php

Line Number: 417

Although it does return the messages I have set if the contact was missing fields and also displays the success message properly, this message is always right below it.

I am not displaying any data before this, nor calling any header-related functions. Looking in the Common.php file, I see it is setting some headers though. Any way around this?

I’m just doing a regular “echo” to return the messages, and I’ve tried JSONing the data (json_encode()) but that just messes it up even more.

Any ideas? Thanks!

       
Gwarrior's avatar
Gwarrior
40 posts
16 years ago
Gwarrior's avatar Gwarrior

Well, I found a fix, but I’m not sure at what cost.

By going into Admin->System Administration->Output and Debugging, I was able to turn off Generate HTTP Headers, which caused the “Headers already sent.” message to go away.

What else is this going to affect?

Thanks!

       
bohara's avatar
bohara
42 posts
15 years ago
bohara's avatar bohara

I would like to know the answer to this as well. i am working on an add-on with a similar issue. Is it possible to overwrite the HTTP Headers with a hook on specific requests?

I’d love any info people can provide.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.