EllisLab text mark
Advanced Search
     
Warning: headers already sent by ...(for AJAX library)
Posted: 11 July 2007 09:23 AM   [ Ignore ]
Joined: 2007-07-11
3 posts

hi

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:

Controller:

<?php
class Ajax extends Controller {
    
    
function Ajax()
    
{
        parent
::Controller();
        
$this->load->library('tinyajax');
    
}    
        
           
    
function multiply()
    
{    
        $this
->tinyajax->showLoading();
        
$this->tinyajax->exportFunction("ajax_multiply", array("first_id""second_id"), "#third_id"$this);
        
        
$this->tinyajax->process();
        
$this->load->view('ajax_multiply');
        
    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->showLoading();
        
$this->tinyajax->exportFunction("ajax_multiplyb", array("first_id""second_id"), null$this);
        
        
$this->tinyajax->process();
        
$this->load->view('ajax_multiplyb');
    

    }    
}
?> 

View:

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

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

will anyone tell me how to fix it ?

 
Posted: 11 July 2007 11:21 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2007-07-05
11 posts

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

Make sure ?> are the EXACT last 2 characters in the file.