Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<script src='https://cdn.firebase.com/js/client/2.2.1/firebase.js'></script>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
<script type="text/javascript">
var db = new Firebase('https://chat-balta-demo.firebaseio.com/chat');
$('#send-button').click(function () {
var message = $('#text-message').val();
db.push({ message: message });
$('#text-message').val("");
});
db.on('child_added', function(snapshot) {
var data = snapshot.val();
$('#messages').append($('<li>').text(data.message));
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment