0
在我的数据库中,我打算创建一个存储消息的表来提醒用户需要做的任何事情。在PHP和MySQL中使用jQuery Growl
我正在寻找使用jQuery咆哮像通知方法,但我很困惑我将如何开始构建它。
数据将从表单中使用标准的MySQL插入方法添加到数据库中,但是如何从数据库中选择消息以使用jQuery咆哮显示。
这是否需要使用AJAX?
这是JavaScript代码,我到目前为止,我不知道我将如何实现PHP代码在它旁边,这样我可以从我的桌子拉出来的数据显示为通知:
<script type="text/javascript">
// In case you don't have firebug...
if (!window.console || !console.firebug) {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
}
(function($){
$(document).ready(function(){
// This specifies how many messages can be pooled out at any given time.
// If there are more notifications raised then the pool, the others are
// placed into queue and rendered after the other have disapeared.
$.jGrowl.defaults.pool = 5;
var i = 1;
var y = 1;
setInterval(function() {
if (i < 3) {
$.jGrowl("Message " + i, {
sticky: true,
log: function() {
console.log("Creating message " + i + "...");
},
beforeOpen: function() {
console.log("Rendering message " + y + "...");
y++;
}
});
}
i++;
} , 1000);
});
})(jQuery);
</script>
<p>
</span>
<p>