how to build jquery messages notification with php and mysq

Solutions on MaxInterview for how to build jquery messages notification with php and mysq by the best coders in the world

showing results for - "how to build jquery messages notification with php and mysq"
Jeanne
31 Feb 2019
1<script>
2
3$(document).ready(function(){
4
5// updating the view with notifications using ajax
6
7function load_unseen_notification(view = '')
8
9{
10
11 $.ajax({
12
13  url:"fetch.php",
14  method:"POST",
15  data:{view:view},
16  dataType:"json",
17  success:function(data)
18
19  {
20
21   $('.dropdown-menu').html(data.notification);
22
23   if(data.unseen_notification > 0)
24   {
25    $('.count').html(data.unseen_notification);
26   }
27
28  }
29
30 });
31
32}
33
34load_unseen_notification();
35
36// submit form and get new records
37
38$('#comment_form').on('submit', function(event){
39 event.preventDefault();
40
41 if($('#subject').val() != '' && $('#comment').val() != '')
42
43 {
44
45  var form_data = $(this).serialize();
46
47  $.ajax({
48
49   url:"insert.php",
50   method:"POST",
51   data:form_data,
52   success:function(data)
53
54   {
55
56    $('#comment_form')[0].reset();
57    load_unseen_notification();
58
59   }
60
61  });
62
63 }
64
65 else
66
67 {
68  alert("Both Fields are Required");
69 }
70
71});
72
73// load new notifications
74
75$(document).on('click', '.dropdown-toggle', function(){
76
77 $('.count').html('');
78
79 load_unseen_notification('yes');
80
81});
82
83setInterval(function(){
84
85 load_unseen_notification();;
86
87}, 5000);
88
89});
90
91</script>
Fabrizia
20 Jun 2016
1<li class="dropdown dropdown-extended dropdown-notification dropdown-dark" id="header_notification_bar">
2
3                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
4                                    <i class="icon-bell"></i>
5                                    <span class="badge badge-success"><div id="datacount"></div></span> </span>
6                                </a>
7                                <ul class="dropdown-menu" >
8                                    <li class="external">
9                                        <h3>
10                                            <span class="bold">12 pending</span> notifications</h3>
11                                        <a href="page_user_profile_1.html">view all</a>
12                                    </li>
13                                    <li>
14                                        <ul class="dropdown-menu-list scroller" style="height: 250px;" data-handle-color="#637283">
15                                            <li>
16                                                <a href="javascript:;">
17                                                    <span class="time">just now</span>
18                                                    <span class="details">
19                                                        <span class="label label-sm label-icon label-success">
20                                                            <i class="fa fa-plus"></i>
21                                                        </span> New user registered. </span>
22                                                </a>
23                                            </li>
24
25                                        </ul>
26                                    </li>
27                                </ul>
28                            </li>
29
Jude
20 May 2019
1<script type="text/javascript">
2
3$(document).ready(function(){
4$("#datacount").load("select.php");
5setInterval(function(){
6$("#datacount").load('select.php')
7}, 20000);
8 });
9
10</script>
11
María Alejandra
06 May 2020
1<?php
2
3include('connect.php');
4
5if(isset($_POST['view'])){
6
7// $con = mysqli_connect("localhost", "root", "", "notif");
8
9if($_POST["view"] != '')
10
11{
12   $update_query = "UPDATE comments SET comment_status = 1 WHERE comment_status=0";
13   mysqli_query($con, $update_query);
14}
15
16$query = "SELECT * FROM comments ORDER BY comment_id DESC LIMIT 5";
17$result = mysqli_query($con, $query);
18$output = '';
19
20if(mysqli_num_rows($result) > 0)
21{
22
23while($row = mysqli_fetch_array($result))
24
25{
26
27  $output .= '
28  <li>
29  <a href="#">
30  <strong>'.$row["comment_subject"].'</strong><br />
31  <small><em>'.$row["comment_text"].'</em></small>
32  </a>
33  </li>
34
35  ';
36}
37}
38
39else{
40    $output .= '<li><a href="#" class="text-bold text-italic">No Noti Found</a></li>';
41}
42
43$status_query = "SELECT * FROM comments WHERE comment_status=0";
44$result_query = mysqli_query($con, $status_query);
45$count = mysqli_num_rows($result_query);
46
47$data = array(
48   'notification' => $output,
49   'unseen_notification'  => $count
50);
51
52echo json_encode($data);
53}
54?>
queries leading to this page
push notification database ajaxphp tools for notifications using mysqlphp mysql notification systemrealtime live notification count like facebook 7c php 7c ajax 7c javascript codeigniterphp realtime notifications with ajax nullednotification message in htmlphp page notificationnotification system with phpphp update notificationpush notifications system php php notification button on website like facebookcreate notification phpsysteme de notification php mysqlphp mysql user notificationphp notification tutorialphp code for notification system using mysqliwhy notic show in phphtml php notification systemdatabase notification in php demosimple live notifications in jquery ajax php mysqlnotification in phpnotification phpfree php mysql real time updatebootstrap notification in php ajax resultphp notification classnotification bell function in phphow to force browser to update js and css files cache after deployajax notification popup examplenotification generate in website when data insertedphp instant notificationsclock notification php javascriptphp notificationshow to add notification in html php notification system in phpbell notification on new order in phpajax notificationphp code for notification systemserver down notification phpnotification system php ajaxinstant notification php codecloud message service android and php sql without firebaseinstanceidservicelive notification ciphp un notificationpush notification in php youtube com soundcloud com residentadvisor net djtunes com junodownload com itunes apple com beatport com trackitdown net djdownload com mixcloud com last fm traxsource comnoticfation system phpphp notificationhow to make an alert for a new record in phplive notifications in jquery ajax laravel mysqlphp 3f 3f creating noticespersonal chat using jquery and php mysqliphp ajax notification systemajax notification in phphow to alert message in phpphp notify javascriptphp notification countbell notification function in phpnotification message using php and jqueryrealtime live notification count like facebook 7c php 7c ajax 7c javascripthow to get notification from phphow to build jquery messages notification with php and mysqhow to use show notifications phprequest notification using php and ajaxusin ajax with php notificationlive notifications in jquery ajax php mysqlcreate a notifications api in phpphp form insert to database and give notificationcreate a simple notifications api in php for my appphp page update notificationhow to create notification dropdown list in phpevent calendar with php 26 mysqlphp mysql js create notificationnotification ajax php mysqlnotification php mysqlajax notification phpcreate a notification system htmlpost notice on homepage using php and mysqlsend message notifications php mysqlhow to make notification in phpphp live notification systemsending emails with node js using smtp 2c gmail 2c and oauth2notification system phpdownload notificaton systemnotifications in phpphp notification systemget fb notifications using graph api and pythonajax notifiy in htmlphp jquery notification popupphp ajax notificationmessage cloud with android and phpcreate a simple notifications api in phphow to build jquery messages notification with php and mysq