Do not put it as a duplicate without reading the full question.
I know this has been discussed many times.
But this is a different case.
I am making a simple ajax call for a php method that looks like this:
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'm just trying to get the data that is transferred using an ajax call.
But I do not get the data sent by ajax call, instead I 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 do not use session_start (); somewhere in my project.
This error points to the session_start () method, which is located in the Session.php file of the Codeigniter libraries. It does not indicate anywhere in my code, so I am not sure where to look for problems.
I have already checked the answers all over the Internet, and none of them seem to have solved this problem.
Can someone explain to me why I am getting this error and how can I prevent this?
Thanks.
Edit: As suggested in the other answers, I checked and removed the spaces 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(){ } }); });