TypeError:无法读取未定义的属性中心

时间:2015-01-06 09:17:17

标签: javascript signalr

我在信号器javascript客户端上运行时遇到异常..

TypeError:无法读取未定义的属性中心

请帮我解决这个异常..谢谢..

我的Javascript文件是......

<!--Script references. -->
<!--Reference the jQuery library. -->
<script src="Scripts/jquery-1.6.4.min.js"></script>
<!--Reference the SignalR library. -->
<script src="Scripts/jquery.signalR-2.1.0.min.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="http://localhost:8080/signalr/hubs"></script>
<!--Add script to update the page and send messages.-->
<script type="text/javascript">
    $(function () {
        try
        {
            alert("inside function");
            //Set the hubs URL for the connection

            $.connection.hub.url = "http://localhost:8080/signalr";

            // Declare a proxy to reference the hub.
            var chat = $.connection.myHub;
            alert(chat);
            // Create a function that the hub can call to broadcast messages.

            // Start the connection.


            $.connection.hub.start().done(function () {
                alert("Connection succeeded");
            }).fail(function () {
                alert("Connection failed");
            });


        }
        catch (err) {
            alert("Error:" + err);

        }
    });


</script>

0 个答案:

没有答案