I develop an asp.net mvc application with the real-time messaging system based on the SignalR (jquery.signalR-2.0.0-beta2.js). The problem is that all partial views cannot be loaded after the SignalR connection started. In this case all ajax requests after the $.connection.hub.start({ transport: 'longPolling'}).done(function () { applicationHub.server.connectUser(); }) stay in pending state. Is it posible to make this requests async or is it a bug in the SignalR? Thanks for your help!
SignalR call:
<script type="text/javascript">
$(document).ajaxStop(function () {
var applicationHub = $.connection.applicationHub;
if ($.connection.hub && $.connection.hub.state == $.signalR.connectionState.disconnected) {
registerConversationClientMethods(applicationHub);
$.connection.hub.start({ transport: 'longPolling'}).done(function () {
applicationHub.server.connectUser();
})
.fail(function () {
});
}
});
</script>
Ajax call which renders a partial view:
function LoadActivities(id, type, container, action, loaderpath) {
var url = action + '/?id=' + id + '&type=' + type;
var targetDiv = container;
var ajaxLoading = "<img id='ajax-loader' src='" + loaderpath + "' height='6' width='50' style='margin:5px;'>";
$(targetDiv).html("<div align='center'>" + ajaxLoading + "</div>");
$.get(url, null, function (result) {
$(targetDiv).html(result);
});
}