Created
July 9, 2015 21:29
-
-
Save andrebaltieri/a80595202997a0e77721 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="Scripts/jquery-1.6.4.min.js"></script> | |
<script src="Scripts/jquery.signalR-2.2.0.min.js"></script> | |
<script src="signalr/hubs"></script> | |
<script type="text/javascript"> | |
$(function () { | |
$.connection.hub.url = "/signalr"; | |
var chat = $.connection.chatHub; | |
chat.client.addMessage = function (message) { | |
$('#messages').append($('<li>').text(message)); | |
}; | |
$('#send-button').click(function () { | |
var message = $('#text-message').val(); | |
chat.server.send(message); | |
$('#text-message').val("") | |
return false; | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment