yesod/yesod-examples/static/chat.js
Michael Snoyman 41faf62094 Add 'yesod-examples/' from commit '851f928e55b3646f7790b6cc70968957cca04a4b'
git-subtree-dir: yesod-examples
git-subtree-mainline: 2dc10de435
git-subtree-split: 851f928e55
2011-07-22 08:59:56 +03:00

22 lines
554 B
JavaScript

$(document).ready(function () {
$("form").submit(function (e) {
e.preventDefault();
$.getJSON("/post", { name: $("#name").attr("value"), send: $("#send").attr("value") }, function(o) { });
$("#send").attr("value", "");
});
checkIn();
});
function checkIn () {
$.getJSON("/check", { client: clientNumber }, function(o) {
//alert("response: " + o);
var ta = $("textarea");
ta.html(ta.html() + o.sender + ": " + o.content + "\n");
ta.scrollTop(10000);
checkIn();
});
}