问题
I have found that the function within a signalr client hub method is not always triggered when enclosed within a jquery .ready() method. For example this does not always work:
$(function(){
hubname.client.methodName = function () {
//do something
}
})
whereas the following works reliably:
hubname.client.methodName = function () {
//do something
}
can anyone explain this to me? This pattern of behaviour is not constant, and occurs for me in both chrome and internet explorer.
来源:https://stackoverflow.com/questions/45925309/signalr-client-hub-events-not-being-triggered-within-a-jquery-ready-method