Ejemplo 1: javascript para enviar notificaciones al navegador
<!doctype html>
<head>
<title>Show Notification using Javascript</title>
</head>
<body>
<h3>Show Notification using Javascript</h3>
<script>
/* JS comes here */
askForApproval();
function askForApproval() {
if(Notification.permission === "granted") {
createNotification('Wow! This is great',
'created by @study.tonight',
'https://www.studytonight.com/css/resource.v2/icons/studytonight/st-icon-dark.png');
}
else {
Notification.requestPermission(permission => {
if(permission === 'granted') {
createNotification('Wow! This is great', 'created by @study.tonight', 'https://www.studytonight.com/css/resource.v2/icons/studytonight/st-icon-dark.png');
}
});
}
}
function createNotification(title, text, icon) {
const noti = new Notification(title, {
body: text,
icon
});
}
</script>
</body>
</html>
Ejemplo 2: notificación de envío de datos en javascript
<script src="http://www.jqueryscript.net/demo/Sliding-Growl-Notification-Plugin-For-jQuery-jsnotify/dist/js/notify.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<link href="http://www.jqueryscript.net/demo/Sliding-Growl-Notification-Plugin-For-jQuery-jsnotify/dist/css/notify.css" rel="stylesheet"/>
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet"/>
<form action="" method="post" id="myDiv">
<input type="text" name="name" id="n1">
<input type="text" name="mobile" id="n2">
<input type="submit" name="submit" value="click me">
</form>
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)