简体   繁体   English

未捕获的TypeError:对象函数

[英]Uncaught TypeError: Object function

I'm trying to implement ChatJS (chatjs.net) in web program. 我正在尝试在Web程序中实现ChatJS(chatjs.net)。 When I add all the scripts and and use this code: 当我添加所有脚本并使用以下代码时:

  $.chat({
    // your user information
    user: {
        Id: 3,
        Name: 'John Silver',
        ProfilePictureUrl: 'http://www.foo.com/avatar/123'
    },
    // text displayed when the other user is typing
    typingText: ' is typing...',
    // the title for the user's list window
    titleText: 'ChatJS demo chat',
    // text displayed when there's no other users in the room
    emptyRoomText: "There's no one around here.",
    // the adapter you are using. There are 2 implementations out of the box:
    // SignalRAdapter and LongPollingAdapter (server independent).
    adapter: new LongPollingAdapter()
});

The web browser throws an error: Web浏览器抛出错误:

Uncaught TypeError: Object function (e,n){return new x.fn.init(e,n,t)} has no method 'chat' localhost:8000/try2/:253 (anonymous function)

How can I fix this? 我怎样才能解决这个问题? If this can't be fixed easily, can someone recommend a similar open source program? 如果无法轻松解决此问题,有人可以推荐类似的开源程序吗?

After I rechecked my code, I realized that I forgot include a JS library. 重新检查代码后,我意识到我忘记了包含JS库。 After I included it, it started working. 加入它之后,它开始起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM