Skip to content

Instantly share code, notes, and snippets.

@smgt
Created April 19, 2011 18:48
Show Gist options
  • Save smgt/929236 to your computer and use it in GitHub Desktop.
Save smgt/929236 to your computer and use it in GitHub Desktop.
<html>
<head></head>
<body>
<div id="message">
</div>
<input type="text" id="text-input">
<input type="submit" id="send-button">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="http://localhost:8888/nowjs/now.js"></script>
<script>
$(document).ready(function(){
now.name = prompt("name?", "");
now.receiveMessage = function(name, message){
$("#message").append("<br>"+ name +": "+message);
};
$("#send-button").click(function(){
now.distributeMessage($("#text-input").val());
$("#text-input").val("");
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment