CodeIgniter Forums

Full Version: Warning: headers already sent by ...(for AJAX library)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum


im trying to use the projax and tinyAjax library , i also configured them as the are asked in CI wiki but in both case im gating the following warning ( i know why its happened usually "register_globals" , i have tried to fix it by making it off/on but its not working.)

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at D:\wamp\www\PD\system\application\controllers\ajax.php:40)

Filename: errors/error_404.php

Line Number: 1

my controller and view file are as bellow:

class Ajax extends Controller {
    function Ajax()
    function multiply()
        $this->tinyajax->exportFunction("ajax_multiply", array("first_id", "second_id"), "#third_id", $this);
    function ajax_multiplyb($x, $y)
      $res = $x * $y;
      $res_text = "Multiplying $x and $y results in $res";
      $tab = new TinyAjaxBehavior();
      $tab->add(TabSetValue::getBehavior("third_id", $res));
      $tab->add(TabInnerHtml::getBehavior("result_div", $res_text));
      return $tab->getString();

    function multiplyb()
        $this->tinyajax->exportFunction("ajax_multiplyb", array("first_id", "second_id"), null, $this);

<? $this->tinyajax->drawJavaScript(false,true); ?>
    &lt;input type="text" id="first_id" value="2"&gt; *
    &lt;input type="text" id="second_id" value="3"&gt; =
    &lt;input type="text" id="third_id" value=""&gt;
    &lt;input type="button" value=" * " onclick="ajax_multiplyb()"&gt;
    <div id="result_div">&nbsp;</div>

i think both of the library is not working for one reason.

will anyone tell me how to fix it ?

El Forum

Do you have a trailing space or new-line at the end of the file?

Make sure ?&gt; are the EXACT last 2 characters in the file.