lundi 1 avril 2019

CodeIgniter Javascript Onclick Not Working

I created a new option for my script on Admin->Users page. (and int type colum in users table.)

<li>
<?php if ($user->uyelik_tipi != "Bireysel"): ?>
 <a href="javascript:void(0)" onclick="kurumsal_onay(<?php echo $user->id; ?>);"><i class="fa fa-building option-icon"></i>Kurumsalı Onayla</a>
<?php endif; ?>
 </li>

This code in Admin_Controller.php page:

/*
Kurumsal Hesabı Onayla
*/
public function kurumsal_onay()
{
    $id = $this->input->post('id', true);
    $user = $this->auth_model->get_user($id);
    if ($this->auth_model->kurumsali_onayla($user)) {
        $this->session->set_flashdata('success', trans("msg_updated"));
    } else {
        $this->session->set_flashdata('error', trans("msg_error"));
    }
}

This code in Auth_Model.php:

//kurumsalı onayla
    public function kurumsali_onayla($user)
    {
        if (!empty($user)) {
            $data = array(
                'kurum_onay' => 1,

            );
            $this->db->where('id', $user->id);
            return $this->db->update('users', $data);
        }
        return false;
    }

But when i click to Link, nothing happens :/

Aucun commentaire:

Enregistrer un commentaire