close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

job notification

Thread began 1/12/2020 12:13 pm by Gizza372666 | Last modified 1/14/2020 5:09 pm by Ray Borduin | 890 views | 8 replies |

Gizza372666

job notification

Hi,
Can you please let me know how to create a job notification?
I have creted a php qry which will extract all records where a customer has requested a callback.
What I need is on the admin side at the top, a notification to show with the number of customers who expecting a callback.
It has to show the number of customers without the page being refreshed.

I have found this script and works fine however it is conflicting with the webassist script and my cms doent's work properly.
Is there a build in functionality which will allow me to do this?

Here is the current js script:
=========================Script Starts========================================
<script src="jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="bootstrap.min.js"></script>
<br /><br />
<div>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#"></a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="label label-pill label-danger count" style="border-radius:10px;"></span> <span class="glyphicon glyphicon-bell" style="font-size:18px;"></span></a>
<ul class="dropdown-menu"></ul>
</li>
</ul>
</div>
</nav>
<br />
<script>
$(document).ready(function(){

function load_unseen_notification(view = '')
{
$.ajax({
url:"fetch.php",
method:"POST",
data:{view:view},
dataType:"json",
success:function(data)
{
$('.dropdown-menu').html(data.notification);
if(data.unseen_notification > 0)
{
$('.count').html(data.unseen_notification);
}
}
});
}

load_unseen_notification();


$(document).on('click', '.dropdown-toggle', function(){
$('.count').html('');
load_unseen_notification('yes');
});

setInterval(function(){
load_unseen_notification();;
}, 5000);

});
</script>





==============================Script End======================================


=========================php script starts======fetch.php====================================


<?php
include("connect.php");


if(isset($_POST['view'])){


if($_POST["view"] != '')
{

}
$query = "SELECT * FROM tblcustomer WHERE job=1 LIMIT 5";
$result = mysqli_query($con, $query);
$output = '';
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{
$output .= '
<li>
<a href="#">
<a href="http://domain.com/tblcustomer_update.php?ID='.$row["ID"].'" <strong>'.$row["Email"].'</strong></a>

</a>
</li>
<br /><br />
';

}
}
else{
$output .= '
<li><a href="#" class="text-bold text-italic">No Noti Found</a></li>';
}



$status_query = "SELECT * FROM tblcustomer WHERE job=1";
$result_query = mysqli_query($con, $status_query);
$count = mysqli_num_rows($result_query);
$data = array(
'notification' => $output,
'unseen_notification' => $count
);

echo json_encode($data);

}

?>

=========================php script end==========================================

I hope you will understand what I'm trying to achive and that it will be an easy way to be created with webassist.
Looking forward to your reply

Sign in to reply to this post

Ray BorduinWebAssist

You can refresh a section of the page like a count from the database without a page refresh using AJAX and the Behavior: Webassist->Framework->Load Plugin to Div.

Just create a separate .php page that shows the count from the database and then you can load or reload that page into a div when you need to without a page refresh.

Sign in to reply to this post
Did this help? Tips are appreciated...

Gizza372666

Not sure I follow

Hi,
I tried to follow your instructions but it doesn't work.
Can you please have a look and let me know what I'm doing wrong?
Also I want the div to refresh automaticaly every 10 secs without the user pressing anything.
looking forwared to your reply

Sign in to reply to this post

Ray BorduinWebAssist

Change your page body to:

html:
<body>
<div id="myjobs">
</div>
<form ><input type="button" onClick="framework_load_plugin_url('fetch2.php',false,'myjobs','../','');return document.MM_returnValue"></form>
</body>



make sure that works with the button press updating the div with the current count.

Once that works, then you can remove the button and use a setTimeout() call to do it every 5 seconds instead. That looks like:

html:
<body>
<div id="myjobs">
</div>
<script>
var refreshTimer = false;
function refreshDiv() {
if (refreshTimer) clearTimeout(refreshTimer);
refreshTimer = setTimeout("framework_load_plugin_url('fetch2.php',false,'myjobs','../','')", 5000);
}
refreshDiv();
</script>
</body>
Sign in to reply to this post
Did this help? Tips are appreciated...

Gizza372666

It can't find the page.

Sign in to reply to this post

Ray BorduinWebAssist

I think it should be:

ss/fetch2.php

Sign in to reply to this post
Did this help? Tips are appreciated...

Gizza372666

still not working.

Sign in to reply to this post

Ray BorduinWebAssist

Upload the webassist/framework folder to the live server. There are some files that aren't up there that are needed.

Sign in to reply to this post
Did this help? Tips are appreciated...

Gizza372666

Thank you very much Ray!
Top man!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...