Notifikasi suara saat ada data baru yang masuk

Ane pengin saat user berhasil create data nanti bakalan muter audio caranya gimana ya gan..? ane pake framework codeigniter

CONTROLLER

public function postcomment()
	{
		$this->form_validation->set_rules('comment','Commment','required');
		$this->form_validation->set_rules('subject','Subject','required');
		if($this->form_validation->run() != false){
		$comment = $this->input->post('comment');
		$subject = $this->input->post('subject');

		$data = array(
			'comment' => $comment,
			'subject' => $subject
			);
		$this->m_comment->input_data($data,'comments');
		$_SESSION['pesan'] = 'Data berhasil di kirim';
		redirect('home/contact');

		}else{
			$this->load->view('web/contact',$data);
		}
	}

MODEL

function update_data($where,$data,$table){
		$this->db->where($where);
		$this->db->update($table,$data);
	}

AUDIONYA

<audio id="myAudio">
    <source src="<?php echo base_url(); ?>assets/AdminLTE/sound/line_messenger.mp3" type="audio/mpeg">
      Your browser does not support the audio element.
    </audio>

NOTIFIKASI NAVBAR

<a class="nav-link" id="notification-icon" data-toggle="dropdown" href="#">
              <i class="far fa-comments"></i>
              <span id="notif-count" class="badge badge-danger navbar-badge"><?php if($count>0) { echo $count; } ?></span>
              <div id="notification-latest"></div>
            </a>

avatar MRifai
@MRifai

18 Kontribusi 0 Poin

Diperbarui 4 tahun yang lalu

1 Jawaban:

Bisa pakai library javascript namanya Howler. Tapi waktu klik button create harus pakai ajax, biar halamannya tidak direload.

avatar rikicmd
@rikicmd

2 Kontribusi 0 Poin

Dipost 4 tahun yang lalu

Tanggapan

ok terimakasih gan saya coba

Login untuk ikut Jawaban