Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
<div class="row">
<div class="col-md-12">
<div id="messagesTable">
@section scripts
<script src="~/Scripts/jquery.signalR-2.2.0.min.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="~/signalr/hubs"></script>
<script type="text/javascript">
var link = '@Url.Action("GetMessages", "Home")';
$(function () {
// Declare a proxy to reference the hub. v
var notifications = $.connection.chatHub;
// Create a function that the hub can call to broadcast messages.
notifications.client.updateMessages = function () { getAllMessages() };
// Start the connection.
.done(function () { getAllMessages(); })
.fail(function (e) { alert(e); }); });
function getAllMessages() {
var tbl = $('#messagesTable');
cache: false,
url: link,
dataType: "json",
type: 'GET'
.success(function (data) {
var array = String(data).split(",");
for (var i in array) {
tbl.append('<div>Insurer: ' + array[i] + '</div>');
.error(function (response) { alert(response) }); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment