corrade-http-templates
/groupChat/groupChat.html |
@@ -15,15 +15,7 @@ |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> |
<script type="text/javascript"> |
$(document).ready(function () { |
setInterval(function () { |
$.get("chat.log?t=" + Math.random(), function(data) { |
$("#chat").html(data); |
}); |
$("#chat").animate({ |
scrollTop:$("#chat")[0].scrollHeight - $("#chat").height() |
},1000); |
}, 1000); |
$("#send").click(function(e){ |
function sendGroupMessage() { |
$("#controls").animate({ opacity: 'hide' }, 'slow'); |
$.ajax({ |
type: 'post', |
@@ -36,7 +28,25 @@ |
$('#message').val(""); |
$("#controls").animate({ opacity: 'show' }, 'slow'); |
}); |
} |
setInterval(function () { |
$.get("chat.log?t=" + Math.random(), function(data) { |
$("#chat").html(data); |
}); |
$("#chat").animate({ |
scrollTop:$("#chat")[0].scrollHeight - $("#chat").height() |
},1000); |
}, 1000); |
$("#send").click(function(e){ |
sendGroupMessage(); |
}); |
// Subscribe to pressing enter with the message input box selected. |
$("#message").keypress(function(e) { |
if (e.which == 13) { |
sendGroupMessage(); |
return false; |
} |
}); |
}); |
</script> |
</head> |