I am working with codeigniter base application. Here I have write ajax function and pass data to my conttoller. Then it gives an error.
My ajax code is like :
$.ajax({
type:"post",
url:"<?php echo base_url(); ?>login/insert_fb",
data:{record:record,id:id},
success:function(record_Data){
alert(record_Data);
}
});
Here, record variable pass json data.When I print that record in my controller like :
function insert_fb()
{
$data = json_decode($this->input->post($record),true);
print_r($data);
}
then it gives an error like
Undefined variable : record and json_decode() expects parameter 1 to be string,array given.
So, how can I resolve this problem?