NodeJS

2017-05-12 4 views
0

Ich habe eine Seite Anzeigeinformationen von MySQL automatisch mit NodeJS verwenden. Wie kann ich den Text Benutzernamen oder die Beschreibung als Bootstrap-Alarm erscheinen wie „Alarm Alarm-info“?NodeJS

<time></time> 
 
<div id="container">Loading ...</div> 
 
<script src="socket.io/socket.io.js"></script> 
 
<script src="http://code.jquery.com/jquery-latest.min.js"></script> 
 
<script> 
 
// create a new websocket 
 
var socket = io.connect('http://localhost:8000'); 
 
// on message received we print all the data inside the #container div 
 
socket.on('notification', function (data) { 
 
var usersList = "<dl>"; 
 
$.each(data.users,function(index,user){ 
 
\t \t usersList += "<dt>" + user.user_name + "</dt>\n" + 
 
\t \t \t \t \t \t \t \t "<dd>" + user.user_description + "\n" + "</dd>"; 
 
}); 
 
usersList += "</dl>"; 
 
$('#container').html(usersList); 
 

 
$('time').html('Last Update:' + data.time); 
 
}); 
 

 
</script>

Antwort