在我的 Codeigniter 视图中,我有以下代码通过 jquery ajax 函数将当前密码和新密码发送到控制器,但似乎数据没有传递给控制器。看看你能不能帮我解决这个问题。
var url = '<?php echo base_url();?>index.php/it_inventory/change_my_pass';
$.ajax({
type: "POST",
url: url,
//datatype: "json",
data:'cu_pass=' + cu_pass + '&new_pass=' + new_pass,
success: function(r){
if(r==1){
alert("Password Changed Successfully!");
}else{
alert("Error changing password!");
}
}
});
控制器:
public function change_my_pass($cu_pass="", $new_pass=""){
//$cu_pass = $this->input->post('cu_pass');
//$new_pass = $this->input->post('new_pass');
echo $this->it_inventory_model->change_my_pass($cu_pass, $new_pass);
}