Welcome Guest, Not a member yet? Register   Sign In
codeigniter calendar using ajax , problem
#11

[eluser]TheFuzzy0ne[/eluser]
That was a pretty stupid request for me to make. Of course no post data exists. The profiler won't display anything to do with your AJAX request... Sorry...

You could do with logging messages to a file, and using the file to figure everything out. The first point of call would be to dump the $_POST array into an (aptly named) file:
Code:
file_put_contents(APPPATH.'logs/GRR_WHY_WONT_IT_WORK'.EXT, date('Y-m-d H:i:s').' -> '.print_r($_POST, true));

That will only work if your logs directory exists and is writable.
#12

[eluser]dinisptc[/eluser]
its always empty the GRR_WHY_WONT_IT_WORK log file

2013-03-24 16:31:06 -> Array
(
)
#13

[eluser]TheFuzzy0ne[/eluser]
I take it that's from you calling the method via AJAX, not from just loading the page initially?
#14

[eluser]dinisptc[/eluser]
if ($day = $this->input->post('day')) {

file_put_contents(APPPATH.'logs/GRR_WHY_WONT_IT_WORKw'.EXT, date('Y-m-d H:iConfused').' -> '.print_r($_POST, true));

print_r('postv1'.$this->input->post('proj'));


$this->meetingcal_model->add_calendar_data(
"$year-$month-$day",
$this->input->post('data'),
$this->input->post('proj')
);


and now i get


2013-03-24 17:07:42 -> Array
(
[day] => 5
[data] => zsadasdsa
[proj] => 17
[ajax] => 1
)

}
#15

[eluser]TheFuzzy0ne[/eluser]
So the data is definitely getting to the server. I can only assume that you have some code somewhere that is interfering. For now, a workaround would be to use the $_POST array directly, instead of using $this->input->post(). If that doesn't work, then you're definitely emptying the $_POST array at some point.

One more thing: print_r() is used for displaying arrays and objects, not strings. To do it the way you seem to want, you'd need to do something like this:
Code:
echo 'postv1'.$this->input->post(‘proj’).'<br />';

Unless the $_POST field is an array (which in your case, it's not), in which case you'd do this:
Code:
echo 'postv1'.print_r($this->input->post(‘my_array_field’), true).'<br />';
#16

[eluser]dinisptc[/eluser]
this is for calendar library of codeigniter

at the model i am using sessions to capture the projectuid

function add_calendar_data($date,$data,$proj) {

$this->session->set_userdata('proj',$proj);


if($data==-1){

return false;
}


at the view i am doing a new ajax post for the dropdown change


$('#shirts').change( function()
{

$.ajax({
url: [removed],
type: 'POST',
data: {
day: -1,
data: -1,
proj: this.value,
ajax: '1'
},

success: function(msg) {



location.reload();
}
});

});

its working now like a swiss watch
#17

[eluser]TheFuzzy0ne[/eluser]
Glad you got it sorted, although I have to say, I'm still a bit confused. xD




Theme © iAndrew 2016 - Forum software by © MyBB