这是我目前使用nowjs的方式,但这是错误的使用方式吗?
客户:
$('#guestbook_form').validate({
rules: {
message: {
required: true, maxlength: 1000
}
},
submitHandler: function(form) {
now.sendGb($(form).serializeObject());
}
});
now.pushMessage = function(message) {
$('#guestbook_records').append(message);
};
服务器:
everyone.now.sendGb = function(message) {
client.query(
'INSERT INTO guestbook SET owner_id = ?, user_id = ?, message = ?',
[message.id, message.user_id, sanitize(message.message).entityEncode().trim()]
);
everyone.now.pushMessage(message.message);
};
(当然,此代码还有一些其他问题,但仅作为示例)
我还应该如何使用 nowjs?
感谢您的帮助