0
我使用NodeJS自動從MySQL中獲取頁面顯示信息。如何使文本用戶名或說明顯示爲引導警報,如「alert alert-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>