I want to use a SignalR hub in a layout and in a partial page. Here it is described to use hub.start
and done
functions.
So I have two script blocks in my html page where i want to use SignalR:
<script>
$(document).ready(function () {
window.hubReady = $.connection.hub.start();
window.hubReady.done(function () {
...
});
</script>
<script>
$(document).ready(function(e) {
window.hubReady.done(function() {
...
});
});
</script>
In the second script block it says that windows.hubReady.done
can't be executed because it's undefined.
EDIT: block 2 is executed before block 1. But why?