1 回答
TA贡献1811条经验 获得超4个赞
您必须在代码中进行这样的更改。希望它有效。
$('#click').click(function(){
var selected = new Array(); //assigning array to variable
$(".stafftable input[type=checkbox]:checked").each(function(){
selected.push(this.value);
});
var selected_member_id=localStorage.getItem('selectids');
var string_selected=selected.toString(); //converting array to string
$.ajax({
type: "POST",
url:"<?php echo base_url();?>Welcome/send_to_staff",
data: {staff_id:string_selected,members_id:selected_member_id}, //string selected
success:
function(data)
{
if(data==true){
// localStorage.clear();
load_unseen_notification();
}
else{
alert("localstorage not cleared");
}
}
});
});
在控制器中尝试这样,它可能会起作用。它对我有用
public function send_to_staff(){
$staff_id=$this->input->post('staff_id');
$staff_id=json_encode($staff_id); //converting to json
$membersids[]= $this->input->post('members_id');
$members_id=json_encode($membersids); //converting to json
if($staff_id !==''){
$data['staff_id']=$staff_id;
$data['members_id']=$members_id;
$inserted=$this->db->insert('ag_matched_members',$data); //insert query
if($inserted == true){
echo true; //returns true
}
else
{
echo false; //returns false
}
}
}
- 1 回答
- 0 关注
- 119 浏览
添加回答
举报