I know this is discussed already many times, but I think this is different case.
I am making a simple ajax call to a php method which is as below:
public function updateAbout()
{
log_message('debug', "updateAbout is called", false);
log_message('debug',$this->input->post('fname'), false);
log_message('debug', "updateAbout success", false);
}
In this method I am simply trying to get data which is passed by ajax call.
But I don't get data posted by ajax call instead get 2 errors:
Severity: Warning --> session_start(): Cannot send session cache limiter - headers already sent ...\..\\libraries\Session\Session.php 143
Severity: Warning --> Cannot modify header information - headers already sent ..\..\libraries\Session\Session.php 171
Note:
I am not using session_start()
anywhere in my project.
This error is pointing to session_start() method which is in Session.php file of CodeIgniter libraries. It is not pointing to anywhere in my code so I am not sure where do I look for issues.
I have already checked answers all over internet and none of them seem to solve this issue.
Why am I getting this error and how can I prevent this?
Edit:
As per suggestions in other answers, I have checked and removed spaces in <?php ?>
in all my codes.
Here is my JavaScript code where ajx call is made.
$("#btnupdateAbout").click(function(){
$fname=$("#updatefname").val();
$lname=$("#updatelname").val();
$country=$("#updatecountry").val();
$locality=$("#updatelocality").val();
if($('#optradioMale').is(':checked')) { $gender="Male"; }
else{$gender="Female";}
$.ajax({
url:"http://localhost/Voyager/ProfileControls/updateAbout",
data:{'fname':$fname,'lname':$lname,'country':$country,'locality':$locality,'gender':$gender},
method:"POST",
contentType:false,
cache:false,
processData:false,
success:function(){
}
});
});